daylerees / anbu

Anbu profiler for the Laravel PHP Framework.
308 stars 24 forks source link

Anbu::disable() does not work #27

Open gabarba opened 9 years ago

gabarba commented 9 years ago

I had a need to disable the Anbu for a particular request while testing and I was presented with the following error

Undefined index: disable …/­vendor/­daylerees/­anbu/­src/­Profiler.php:338

I figured it was an issue in the Facade class itself so I was able to fix it with the following.

<?php

namespace Anbu\Facades;

use App;

class Anbu
{
    /**
     * Proxy static method calls to module instances.
     *
     * @param  string $method
     * @param  mixed  $args
     * @return mixed
     */
    public static function __callStatic($method, $args)
    {
        // Resolve profiler from container.
        $profiler = App::make('Anbu\\Profiler');

       if($method == 'disable')
        {
           return $profiler->disable();
        }

        if($method == 'hide')
        {
           return $profiler->hide();
        }

        // Return the module instance by method name.
        return $profiler->getModule($method);
    }
}

Im sure that you may have a better solution to this issue than this one but I just wanted to give you a heads up.

toonevdb commented 9 years ago

I have the same issue.

    //Anbu::hide(); // does not work

    $anbu = App::make('Anbu\\Profiler');
    $anbu->hide();