,如果你是5.4,你可以AppServiceProvider下操作如下:
public function register()
{
/*
* Sets third party service providers that are only needed on local/testing environments
*/
if ($this->app->environment() != 'production') {
/**
* Loader for registering facades.
*/
$loader = \Illuminate\Foundation\AliasLoader::getInstance();
/*
* Load third party local aliases
*/
$loader->alias('Debugbar', \Barryvdh\Debugbar\Facade::class);
}
}
,如果你想完全控制5.5下您可以在同一AppServiceProvider做:
public function register()
{
/*
* Sets third party service providers that are only needed on local/testing environments
*/
if ($this->app->environment() != 'production') {
/**
* Loader for registering facades.
*/
$loader = \Illuminate\Foundation\AliasLoader::getInstance();
/*
* Load third party local providers
*/
$this->app->register(\Barryvdh\Debugbar\ServiceProvider::class);
/*
* Load third party local aliases
*/
$loader->alias('Debugbar', \Barryvdh\Debugbar\Facade::class);
}
}
,並在作曲家。在額外的json:
"extra": {
"laravel": {
"dont-discover": [
"barryvdh/laravel-debugbar"
]
}
},
然後,你很好去,啓用和禁用通過.env,我如果它在生產中它將被啓用(本地,測試等),它將被自動禁用。
希望它有幫助,祝你好運!
我做到了,但沒有任何幫助。它如何關閉調試欄? –
@ZbigniewKisły如果你在5.5,看看更新的答案。另外,嘗試用'php artisan view:clear'清除視圖緩存 –