input('token', $request->route('token')); if (empty($token)) { throw new ApiException('token is null',403); } $user = User::where('token', $token)->first(); if (!$user) { throw new ApiException('token is error',403); } Auth::setUser($user); return $next($request); } }