fetcher->get($endpoint); return $categotiesItemsMap; } public function saveMap($categotiesItems, $company = null) { foreach ($categotiesItems as $category_json) { $uuid = $category_json['id']; $name = $category_json['name']; $url = $category_json['url']; $category = Category::firstOrCreate([ 'uuid' => $uuid, 'name' => $name, 'url' => $url, 'company_id' => $company->id ]); $item = new ItemAPI($this->fetcher); $item->saveMap($category_json['items'], $category); } } }