header('Authorization'); if (empty($token)) { throw new AuthenticationException("need authorization"); } $uid = app(AuthService::class)->decryptToken(substr($token, 7)); $u = User::findOrFail($uid); Auth::login($u); return $next($request); } }