From c12c7df34e76d73b41e1c47db5acc230473551c1 Mon Sep 17 00:00:00 2001 From: Nick Zeng Date: Thu, 13 Nov 2025 15:13:54 +0800 Subject: [PATCH] add platform request --- .../Tools/Request/PlatformRequest.php | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 backend/app/Platform/Tools/Request/PlatformRequest.php diff --git a/backend/app/Platform/Tools/Request/PlatformRequest.php b/backend/app/Platform/Tools/Request/PlatformRequest.php new file mode 100644 index 0000000..295e20e --- /dev/null +++ b/backend/app/Platform/Tools/Request/PlatformRequest.php @@ -0,0 +1,52 @@ +filter(function($el) use ($name){ + return strtolower($el['label']) == $name ? $el : null; + }); + + if($platforms->isEmpty()){ + throw new \InvalidArgumentException("tools 中未找到 name 为 $name 的公司信息,请确认 tools 系统中已创建该公司的记录!"); + } + + return $platforms->first(); + } + public static function all($query = []): array + { + $path = 'api/ext/platforms'; + return static::fetch($collection, $path, $query); + + } + + protected static function fetch($path, $query) + { + return static::get($path, $query); + } + + public static function update(int $id, array $data): array + { + $path = "/api/ext/platforms/$id"; + return static::put($path, [], $data); + } + + + + +}