Laravel-debugbar: FatalErrorException: Call to undefined method Barryvdh\Debugbar\Facade::warning()

Created on 16 Oct 2013  路  10Comments  路  Source: barryvdh/laravel-debugbar

Hi

After adding 'Debugbar' => 'Barryvdh\Debugbar\Facade' to the aliases array in app.php

I then try to execute one of my controller actions containing the following:

public function getIndex(){
Debugbar::warning('Watch out..');
}

But I receive the following error:

 Symfony \ Component \ Debug \ Exception \ FatalErrorException
Call to undefined method Barryvdh\Debugbar\Facade::warning()

Have I included the facade incorrectly?

Thanks a lot for you help.

Most helpful comment

Are you in a namespace? If so, you can do \Debugbar::warning('Watch out..');

All 10 comments

Excerpt from 'aliases[]

'Validator'       => 'Illuminate\Support\Facades\Validator',
    'View'            => 'Illuminate\Support\Facades\View',
    'Twitter' => 'Thujohn\Twitter\TwitterFacade',
    'Image' => 'Intervention\Image\Facades\Image',
    'Debugbar' => 'Barryvdh\Debugbar\Facade' ),

Hmm, sorry, cannot really recreate this.
Does this work for you:

app('debugbar')->warning('Watch out..');

No I get:

Class debugbar does not exist

I'm using it in a controller, Do I need a use directive at the top of the controller right?

Are you in a namespace? If so, you can do \Debugbar::warning('Watch out..');

I am not, no.

And is the debugbar showing? It seems like the ServiceProvider isn't really working, which is strange.
What version of Laravel are you on?

@jonwhittlestone instead of

use DebugBar\DebugBar;

do this

use Debugbar;

That will work

I was getting the same issue. Adding use Debugbar; like godfreymakori mentioned worked, but it is strange because normally it should be use Debugbar\Debugbar;

Are you in a namespace? If so, you can do \Debugbar::warning('Watch out..');

This works

Was this page helpful?
0 / 5 - 0 ratings

Related issues

coderdiaz picture coderdiaz  路  4Comments

njbarrett picture njbarrett  路  5Comments

thomthom picture thomthom  路  5Comments

damienfern picture damienfern  路  4Comments

hussein-elhussein picture hussein-elhussein  路  3Comments