user(); if ($user === null) { return $next($request); } if (! Gate::forUser($user)->allows($capability)) { abort(404); } return $next($request); } }