Answer the question
In order to leave comments, you need to log in
Laravel how to enable debugbar for admins only?
Created a middleware called DebugForAdmins
Here is its code:
public function handle(Request $request, Closure $next, $guard = null)
{
$auth = Auth::guard($guard);
if ($auth->user()->isAdmin()) {
\Debugbar::enable();
}
return $next($request);
}
\App\Http\Middleware\DebugForAdmins::class,
\Illuminate\Session\Middleware\StartSession::class,
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question