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

Prashant Shukla picture Prashant Shukla · Sep 14, 2016 · Viewed 16.9k times · Source

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.

Answer

baikho picture baikho · Sep 14, 2016

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

Or add use App; below your namespace.