laravel-5laravel-snappy

Class 'App\Http\Controllers\App' not found in laravel 5.2


I am try to use laravel-snappy for pdf generation.

step 1:

run composer require barryvdh/laravel-snappy

step 2:

add in providers Barryvdh\DomPDF\ServiceProvider::class, and aliases 'PDF' => Barryvdh\DomPDF\Facade::class, in app.php

step 3:

create function

    public function pdfTest() {
    $pdf = App::make('snappy.pdf.wrapper');
    $pdf->loadHTML('<h1>Test</h1>');
    return $pdf->inline();
}

then found error:

Class 'App\Http\Controllers\App' not found

How to resolve it.I appreciate all response. Thanks Ahead.


Solution

  • Add a backward slash before this line: \App::make('snappy.pdf.wrapper');

    Or add use App; below your namespace.