edmond edmond - 1 year ago 215
PHP Question

Snappy PDF Laravel 5.2 not working

I am trying to use Snappy PDF from barrvdh but I'm getting an error.

My code is as below

public function test_pdf($invoice_id)
$invoices = InvoiceHeader::where('id', $invoice_id)->first();
$pdf = PDF::loadView('billing.invoice.test', ['invoice' => $invoices]);
return $pdf->download('invoice'.$invoices->id.'.pdf');

And my error is as below:

"ErrorException in PDFController.php line 28:
Missing argument 1 for App\Http\Controllers\PDFController::test_pdf()"

Please advice on my message.

Thanks a lot

Answer Source

First issue, you missed $invoice_id while calling test_pdf function

And for the second issue :

With your terminal, type this :

cd path/to/your/project
php artisan cache:clear
chmod -R 777 /var/www/html/bootstrap/cache/services.php
composer dump-autoload
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download