How to call loadview Non Statically in laravel?

1.2k Views Asked by At
$pdf = PDF::loadView('pdf_view', $data)->setPaper('a4', 'portrait');

Non static method 'loadView' should not be called statically.intelephense(1036)

1

There are 1 best solutions below

0
Harsh Doshi On

You probably imported the wrong class or you didn't register the facade itself!

If you added the facade in config/app.php you need to do this at the top of your controller

use PDF;

If you want to point to the specific facade class you need to do this

use Barryvdh\DomPDF\Facade as PDF;

PS: Please share your full code and package name for better understanding.