[ 'user' => PlaylistCollaboratorResource::JSON_STRUCTURE, 'added_at', 'fmt_added_at', ], ]; /** @return array */ public function toArray($request): array { return array_merge(parent::toArray($request), [ 'collaboration' => [ 'user' => PlaylistCollaboratorResource::make( PlaylistCollaborator::make( $this->song->collaborator_id, $this->song->collaborator_name, avatar_or_gravatar($this->song->collaborator_avatar, $this->song->collaborator_email), ), ), 'added_at' => $this->song->added_at, 'fmt_added_at' => $this->song->added_at ? Carbon::make($this->song->added_at)->diffForHumans() : null, ], ]); } }