Gediminas Šukys
Gediminas Šukys

Reputation: 7391

How to use Laravel Debugbar in controller?

I got an error Class 'App\Http\Controllers\Debugbar' not found after trying to use in controller action Debugbar::error('Error!');

LARAVEL DEBUGBAR WAS INSTALED IN THIS WAY:

in console composer require barryvdh/laravel-debugbar

in config/app.php adding Barryvdh\Debugbar\ServiceProvider::class and 'Debugbar' => Barryvdh\Debugbar\Facade::class,

Laravel 5.3

Debugbar is working in the website - I can see it at the bottom even after this error. But how to fix this critical error message?

Upvotes: 9

Views: 6033

Answers (1)

Tom
Tom

Reputation: 3331

Either explicitly use the Facade or use Debugbar from the root namespace.

\Debugbar::error('hi');

// OR
use \Debugbar;
Debugbar::error('hi');

// OR
use Barryvdh\Debugbar\Facade as Debugbar;
Debugbar::error('hi');

Upvotes: 11

Related Questions