[ $this->mergeWhen($this->emotions->count() > 0, [ 'emotions' => $this->emotions->map(function ($emotion) { return $emotion->name; })->toArray(), ]), ], ]; } }