public function withholdingCertificate($invoice_uuid) { $provider = auth()->user()->provider; $invoice = Payment::where('uuid', $invoice_uuid) ->where('provider_id', $provider->id) ->with('client') ->firstOrFail(); $pdf = \PDF::loadView('provider.invoices.withholding-certificate', compact('invoice', 'provider')); return $pdf->download('certificat-retenue-' . $invoice->invoice_number . '.pdf'); }