artistRepository = $artistRepository; $this->albumRepository = $albumRepository; } public function update(SongUpdateRequest $request) { $updatedSongs = Song::updateInfo($request->songs, $request->data); return response()->json([ 'artists' => $this->artistRepository->getByIds($updatedSongs->pluck('artist_id')->all()), 'albums' => $this->albumRepository->getByIds($updatedSongs->pluck('album_id')->all()), 'songs' => $updatedSongs, ]); } }