app/Jobs/GenerateInvoicePdfJob.php
class GenerateInvoicePdfJob{ // public function __construct($invoice, $deleteExistingFile = false) { $this->invoice = $invoice; $this->deleteExistingFile = $deleteExistingFile; } public function handle() { $this->invoice->generatePDF('invoice', $this->invoice->invoice_number, $this->deleteExistingFile); return 0; }}