dimanche 10 avril 2016

LARAVEL DOMPDF Wrapper for Laravel 5

I performed the following steps and have an error

step 1

Insert en composer.json

"barryvdh/laravel-dompdf": "0.6.*"

step 2 install

php composer update

step 3

add config/app.php

'providers' => [....

 Barryvdh\DomPDF\ServiceProvider::class,

'aliases' => [....

 'PDF' => Barryvdh\DomPDF\Facade::class,

step 4

routes.php

Route::resource('pdf', 'PdfController');

step 5 create controller from php artisan make:controller PhpController

insert code:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;


class PdfController extends Controller
{
public function Index() {

$pdf = App::make('dompdf.wrapper');
$pdf->loadHTML('<h1>Test</h1>');
return $pdf->stream();

}}

step 5 ERROR

call url localhost/public/pdf

FatalThrowableError in PdfController.php line 16:
Fatal error: Class 'App\Http\Controllers\App' not found

line 22 ....

$pdf = App::make('dompdf.wrapper');

Thank you! for your comments.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire