generation->update(['status' => TemplateGenerationStatus::Processing]); try { $outputPath = $templateFillService->fill($this->generation); $this->generation->update([ 'status' => TemplateGenerationStatus::Completed, 'output_path' => $outputPath, ]); } catch (Throwable $exception) { $this->generation->update([ 'status' => TemplateGenerationStatus::Failed, 'error_message' => $exception->getMessage(), ]); } } }