'How to call loadview Non Statically in laravel?

$pdf = PDF::loadView('pdf_view', $data)->setPaper('a4', 'portrait');

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



Solution 1:[1]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Harsh Doshi