path(), '/'); if ($this->isWhitelisted($path)) { return $next($request); } if (Cache::get(self::CACHE_KEY)) { return response()->json([ 'message' => 'خطا در برقراری ارتباط با سرور', ], 503); } return $next($request); } private function isWhitelisted(string $path): bool { $allowed = [ 'super/settings', 'api/super/settings', ]; foreach ($allowed as $item) { if ($path === $item || str_ends_with($path, '/'.$item)) { return true; } } return false; } }