json($this->playlistRepository->getAllByCurrentUser()); } public function store(PlaylistStoreRequest $request) { $playlist = $this->playlistService->createPlaylist( $request->name, $this->user, (array) $request->songs, $request->rules ); $playlist->songs = $playlist->songs->pluck('id')->toArray(); return response()->json($playlist); } public function update(PlaylistUpdateRequest $request, Playlist $playlist) { $this->authorize('owner', $playlist); $playlist->update($request->only('name', 'rules')); return response()->json($playlist); } public function destroy(Playlist $playlist) { $this->authorize('owner', $playlist); $playlist->delete(); return response()->noContent(); } }