diff --git a/app/Http/Requests/QuoteRequest.php b/app/Http/Requests/QuoteRequest.php new file mode 100644 index 000000000000..f514d4fa0c37 --- /dev/null +++ b/app/Http/Requests/QuoteRequest.php @@ -0,0 +1,34 @@ +invoice_number && ! $invoice) { + $invoice = Invoice::scope() + ->whereInvoiceNumber($this->invoice_number) + ->withTrashed() + ->first(); + + if (! $invoice) { + abort(404); + } + } + + // eager load the invoice items + if ($invoice && ! $invoice->relationLoaded('invoice_items')) { + $invoice->load('invoice_items'); + } + + return $invoice; + } +}