*/ public function toArray($request) { return [ 'id' => $this->id, 'name' => $this->name, 'from_human' => $this->from->format('d.m.Y'), 'to_human' => $this->to->format('d.m.Y'), 'excerpt' => $this->excerpt, 'description' => $this->description, 'config' => $this->config, 'slug' => $this->slug, 'dates' => $this->from->equalTo($this->to) ? $this->from->format('d.m.Y') : $this->from->format('d.m.Y') . ' - ' . $this->to->format('d.m.Y'), 'image' => $this->getMedia('headerImage')->first()->getFullUrl('square'), 'is_active' => $this->is_active, 'is_private' => $this->is_private, ]; } /** * @return array */ public static function meta(): array { return [ 'base_url' => url(''), 'agegroups' => Subactivity::remote()->where('is_age_group', true)->get() ->map(fn ($subactivity) => ['id' => $subactivity->nami_id, 'name' => $subactivity->name]), ]; } }