29.07.2016 Views

laravel-5

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Laravel Cashier 184<br />

.<br />

1 <br />

2 @foreach ($invoices as $invoice)<br />

3 <br />

4 {{ $invoice->dateString() }}<br />

5 {{ $invoice->dollars() }}<br />

6 Download<br />

7 <br />

8 @endforeach<br />

9 <br />

Generating Invoice PDFs<br />

From within a route or controller, use the downloadInvoice method to generate a PDF download<br />

of the invoice. This method will automatically generate the proper HTTP response to send the<br />

download to the browser:<br />

.<br />

1 Route::get('user/invoice/{invoice}', function ($invoiceId) {<br />

2 return Auth::user()->downloadInvoice($invoiceId, [<br />

3 'vendor' => 'Your Company',<br />

4 'product' => 'Your Product',<br />

5 ]);<br />

6 });

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!