*/ public function toArray(Request $request): array { return [ 'id' => $this->id, 'slug' => $this->slug, 'name' => $this->name, 'name_translations' => $this->name_translations, 'description' => $this->description, 'description_translations' => $this->description_translations, 'tenant_id' => $this->tenant_id, 'is_global' => $this->tenant_id === null, 'event_type' => $this->whenLoaded('eventType', function () { return [ 'id' => $this->eventType->id, 'slug' => $this->eventType->slug, 'name' => $this->eventType->name, 'icon' => $this->eventType->icon, ]; }), 'tasks_count' => $this->whenCounted('tasks'), 'events_count' => $this->whenCounted('events'), 'imports_count' => $this->whenCounted('events'), 'is_default' => (bool) ($this->is_default ?? false), 'is_mine' => $this->tenant_id !== null, 'position' => $this->position, 'source_collection_id' => $this->source_collection_id, 'created_at' => $this->created_at?->toISOString(), 'updated_at' => $this->updated_at?->toISOString(), ]; } }