syncPath = $syncPath; $this->id = $id; // Use the 'save-trigger' queue or a dedicated 'sync' queue $this->onQueue('save-trigger'); } /** * Execute the job. */ public function handle(): void { Log::info("=== SyncTriggerJob STARTED ===", [ 'sync_path' => $this->syncPath, 'id' => $this->id, 'timestamp' => now() ]); try { // Render the view to trigger its internal logic // We use render() which will execute the PHP code inside the Blade file $output = view($this->syncPath, ['id' => $this->id])->render(); Log::info("=== SyncTriggerJob COMPLETED ===", [ 'sync_path' => $this->syncPath, 'id' => $this->id, 'timestamp' => now() ]); } catch (\Exception $e) { Log::error("SyncTriggerJob FAILED", [ 'sync_path' => $this->syncPath, 'id' => $this->id, 'error' => $e->getMessage(), 'trace' => $e->getTraceAsString() ]); throw $e; } } /** * Get the job's description for Telescope. */ public function getDescription(): string { return "Sync Trigger: {$this->syncPath} for ID {$this->id}"; } /** * Get the tags that should be assigned to the job. */ public function tags(): array { return [ "SyncTrigger", "View:{$this->syncPath}", "ID:{$this->id}" ]; } }