user()?->tokenCan('*')) { return $next($request); } if ($request->ajax() || $request->wantsJson()) { abort(Response::HTTP_UNAUTHORIZED); } return redirect()->guest('/'); } }