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); } }