'array', 'description' => 'array', ]; /** * Tasks in this collection */ public function tasks(): BelongsToMany { return $this->belongsToMany( Task::class, 'task_collection_task', 'task_collection_id', 'task_id' ); } /** * Events that use this collection */ public function events(): BelongsToMany { return $this->belongsToMany( Event::class, 'event_task_collection', 'task_collection_id', 'event_id' ); } /** * Get the localized name for the current locale */ public function getLocalizedNameAttribute(): string { $locale = app()->getLocale(); return $this->name[$locale] ?? $this->name['de'] ?? 'Unnamed Collection'; } /** * Get the localized description for the current locale */ public function getLocalizedDescriptionAttribute(): ?string { if (!$this->description) return null; $locale = app()->getLocale(); return $this->description[$locale] ?? $this->description['de'] ?? null; } }