Reputation: 66
After the installation process is finished, in order to properly register the service provider and alias, you should insert the following lines into the config/app.php file:
'providers' => ServiceProvider::defaultProviders()->merge([
// ...
Barryvdh\DomPDF\ServiceProvider::class,
],
'aliases' => Facade::defaultAliases()->merge([
// ...
'PDF' => Barryvdh\DomPDF\Facade::class,
],
However, it is important to note that an error may occur indicating that 'Barryvdh\DomPDF\Facade' is an Undefined type.
I have verified that the domPDF package has been successfully installed.
Upvotes: -1
Views: 100
Reputation: 146
INSTEAD OF
'PDF' => Barryvdh\DomPDF\Facade::class,
USE
'PDF' => Barryvdh\DomPDF\Facade\Pdf::class,
INSIDE YOUR CONTROLLER:
use Illuminate\Support\Facades\File;
$pdf = Pdf::loadView('pdf_view', $data);
Upvotes: 1