*/ public function toArray(Request $request): array { return [ 'id' => $this->id, 'name' => $this->name, 'description' => $this->description, 'user' => new UserResource($this->whenLoaded('user')), 'cities' => CityResource::collection($this->whenLoaded('cities')), 'cities_count' => $this->whenCounted('cities'), 'created_at' => $this->created_at?->toISOString(), 'updated_at' => $this->updated_at?->toISOString(), ]; } }