mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-24 12:09:02 -05:00
fix: deleting playlists
This commit is contained in:
@@ -231,10 +231,14 @@ class PlaylistController extends Controller
|
||||
public function destroy($id)
|
||||
{
|
||||
$user = \auth()->user();
|
||||
$playlist = Playlist::findOrFail($id);
|
||||
$playlist = Playlist::with('torrents')->findOrFail($id);
|
||||
|
||||
\abort_unless($user->id == $playlist->user_id || $user->group->is_modo, 403);
|
||||
|
||||
foreach ($playlist->torrents as $playlistTorrent) {
|
||||
$playlistTorrent->delete();
|
||||
}
|
||||
|
||||
$playlist->delete();
|
||||
|
||||
return \redirect()->route('playlists.index')
|
||||
|
||||
Reference in New Issue
Block a user