Added the support for generating docs from template doc
This commit is contained in:
@@ -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(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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) {}
|
||||
}
|
||||
Reference in New Issue
Block a user