fill($data); $invoice->save(); $invoice_calc = new InvoiceCalc($invoice, $invoice->settings); $invoice = $invoice_calc->build()->getInvoice(); $invoice->save(); return $invoice; } /** * Mark the invoice as sent. * * @param \App\Models\Invoice $invoice The invoice * * @return Invoice|\App\Models\Invoice|null Return the invoice object */ public function markSent(Invoice $invoice) : ?Invoice { if($invoice->status_id >= Invoice::STATUS_SENT) return $invoice; $invoice->status_id = Invoice::STATUS_SENT; $invoice->save(); return $invoice; } }