I have a production site (laravel 5.8) which sometime have bug. This bug are not in local. SO i wanted to enable barryvdh debugbar but just for admin in production.
I created DebugMiddleware
<?php
namespace App\Http\Middleware;
use App\User;
use Closure;
use Illuminate\Http\Request;
class DebugMiddleware
{
public function handle($request, Closure $next) // permet d'afficher la debugbar en prod
{
if (auth()->user() && in_array(auth()->id(), [1])) {
\DebugBar::enable();
}
else {
Debugbar::disable();
}
return $next($request);
}
}
i added this in kernel :
protected $middlewareGroups = [
......
\Barryvdh\Debugbar\Middleware\InjectDebugbar::class,
\App\Http\Middleware\DebugMiddleware::class, /// affiche la debugbar en prod pour l'user 1
And in debugbar.php i have :
'enabled' => env('DEBUGBAR_ENABLED', null),
The problem is an error
Class DebugBar' not found
when i try to load any page on the site.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire