Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Laravel Debugbar in controller?

Tags:

laravel-5

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?

like image 561
Gediminas Avatar asked Jan 18 '17 08:01

Gediminas


People also ask

What is laravel Debugbar?

This is a package to integrate PHP Debug Bar with Laravel. It includes a ServiceProvider to register the debugbar and attach it to the output. You can publish assets and configure it through Laravel.


1 Answers

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');
like image 121
Tom Avatar answered Oct 08 '22 16:10

Tom