Laravel/PHP Articles

Articles from Laravel/PHP sites on the web

Laravel/PHP Articles
* * @param array $config * @return void */ public function __construct(array $config = []) { parent::__construct($config['binary'], $config['generator']); } /** * Render the PDF preview. * * @param \App\Invoice $invoice * @return string */ public function render(Invoice $invoice) { return $this->getOutputFromHtml( View::make('your.blade.template', compact('invoice'))->render() ); } }It’s very similar to the DOMPDF approach. * * @return array */ public function provides() { return [Pdf::class]; } }Please note, since Laravel 5.8, the $defer property is deprecated. * * @param \App\Services\Pdf $pdf * @return void */ public function __construct(Pdf $pdf) { $this->middleware('auth'); $this->pdf = $pdf; } /** * Generate the PDF to inspect or download. * * @param \Illuminate\Http\Request $request * @param \App\Invoice $invoice * @return \Illuminate\Http\Response */ public function __invoke(Request $request, Invoice $invoice) { return response($this->pdf->render($invoice), 200)->withHeaders([ 'Content-Type' => 'application/pdf', 'Content-Disposition' => ($request->has('download') ?

Sign Up For Our Newsletter

Each Week, We curate the top Laravel/PHP articles, jobs, events and More!

We'll send you a weekly email with the latest Laravel/PHP articles, jobs and events. Please review our Code of Conduct in the meantime. Talk to you soon!