- CertificateService: Intervention Image v3 text overlay on template - GenerateCertificateJob: queued generation with retry logic - SendCertificateEmailJob: stub (implemented in Fasa 8) - CertificateTemplateController: upload, config editor, preview, test generate - Admin/CertificateController: list, generate-all, email-all - Public/CertificateController: show with questionnaire gate, download - DejaVuSans fonts bundled under resources/fonts - Views: admin template/certificate management, public certificate download Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
35 lines
894 B
PHP
35 lines
894 B
PHP
<?php
|
|
|
|
namespace App\Jobs;
|
|
|
|
use App\Models\Certificate;
|
|
use App\Models\Program;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
class SendCertificateEmailJob implements ShouldQueue
|
|
{
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
public int $tries = 3;
|
|
public int $backoff = 60;
|
|
|
|
public function __construct(public readonly Certificate $certificate) {}
|
|
|
|
public function handle(): void
|
|
{
|
|
// Implemented in Fasa 8 — email blast
|
|
}
|
|
|
|
public static function dispatchBatch(Program $program): void
|
|
{
|
|
$program->certificates()
|
|
->whereIn('status', ['generated'])
|
|
->whereNull('emailed_at')
|
|
->each(fn($cert) => static::dispatch($cert));
|
|
}
|
|
}
|