header('Authorization'); if (empty($token)) { throw new AuthenticationException("need authorization"); } $uid = app(AuthService::class)->decryptToken(substr($token, 7)); $u = User::find($uid); if (is_null($u)) { return response()->json([ "code" => 401, ]); } Auth::login($u); logger()->info("admin operation log", [ "url" => $request->url(), "method" => $request->method(), "request" => $request->all(), ]); return $next($request); } }