private function getCreators($playlists) { $ids = $playlists->map(function ($item) { return $item->channel_id; }); return $this->channelService->getCreatorsBatch($ids); }
/** * @param Collection $payload * @return Collection */ public function process($payload) { $dataCollection = $payload; if ($dataCollection->has('series')) { $creatorId = $dataCollection->get('series')->channel_id; $creator = $this->channelService->getCreator($creatorId); $dataCollection = $dataCollection->put('creator', $creator->first()); } return $dataCollection; }