$this->id, 'name' => $this->name, 'user_dishes' => $this->mapDishes(), ]; } private function mapDishes(): array { return $this->userDishes ->map(fn (UserDish $userDish) => [ 'id' => $userDish->id, 'dish' => [ 'id' => $userDish->dish->id, 'name' => $userDish->dish->name, ], 'recurrences' => [], ]) ->toArray(); } }