*/ public function toArray(Request $request): array { $items = Item::where('category_id', $this->id) ->where('count', 0) ->get(); return [ 'id' => $this->id, 'uuid' => $this->uuid, 'name' => $this->name, 'url' => $this->url, 'items' => ItemResource::collection($items) ]; } }