Class 'App\Http\Controllers\App' not found in laravel 5.2
Asked Answered
V

1

12

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.

Viridi answered 14/9, 2016 at 17:11 Comment(0)
M
30

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

Or add use App; below your namespace.

Microcrystalline answered 14/9, 2016 at 18:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.