input('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); } $request->merge([ 'user' => $user ]); return $next($request); } }