Added the support for generating docs from template doc

This commit is contained in:
Simon Pocrnjič
2025-10-06 21:46:28 +02:00
parent 0c8d1e0b5d
commit cec5796acf
69 changed files with 4570 additions and 374 deletions
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace App\Events;
use App\Models\Document;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class DocumentGenerated
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public function __construct(public Document $document)
{
// Fire off preview generation immediately if enabled without waiting for listener chaining
$settings = app(\App\Services\Documents\DocumentSettings::class)->get();
if ($settings->preview_enabled) {
try {
dispatch(new \App\Jobs\GenerateDocumentPreview($document->id));
} catch (\Throwable $e) {
\Log::warning('Failed to dispatch preview job on event', [
'document_id' => $document->id,
'error' => $e->getMessage(),
]);
}
}
}
}
+15
View File
@@ -0,0 +1,15 @@
<?php
namespace App\Events;
use App\Models\DocumentSetting;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class DocumentSettingsUpdated
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public function __construct(public DocumentSetting $settings) {}
}