摘要
正在生成中……
为了在 debuger的message tab里输出内容,需要加入到provides
// config/app.php
'providers' => ServiceProvider::defaultProviders()->merge([
/*
* Package Service Providers...
*/
/*
* Application Service Providers...
*/
//message info in debugbar
Barryvdh\Debugbar\ServiceProvider::class,
//...
测试一下
// routes/web.php
use Barryvdh\Debugbar\Facades\Debugbar;
Route::get('/welcome',function(){
// Debugbar::info('INFO');
Debugbar::info('hello');
return view('welcome');
});
可用的方法除了 info
还有以下
//vendor/barryvdh/laravel-debugbar/src/Facades/Debugbar.php
* @method static LaravelDebugbar addCollector(DataCollectorInterface $collector)
* @method static void addMessage(mixed $message, string $label = 'info')
* @method static void alert(mixed $message)
* @method static void critical(mixed $message)
* @method static void debug(mixed $message)
* @method static void emergency(mixed $message)
* @method static void error(mixed $message)
* @method static LaravelDebugbar getCollector(string $name)
* @method static bool hasCollector(string $name)
* @method static void info(mixed $message)
* @method static void log(mixed $message)
* @method static void notice(mixed $message)
* @method static void warning(mixed $message)
发布配置
php artisan vendor:publish --provider="Barryvdh\Debugbar\ServiceProvider"
让它记录每个请求的信息
# .env
DEBUGBAR_OPEN_STORAGE=true