mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-21 20:48:00 +01:00
#86: Fixed editing albums with more than 1 track
This commit is contained in:
parent
45dae68497
commit
a57c1640e8
1 changed files with 8 additions and 1 deletions
|
@ -63,7 +63,6 @@ class EditAlbumCommand extends CommandBase
|
|||
'title' => 'required|min:3|max:50',
|
||||
'cover' => 'image|mimes:png|min_width:350|min_height:350',
|
||||
'cover_id' => 'exists:images,id',
|
||||
'track_ids' => 'exists:tracks,id',
|
||||
'username' => 'exists:users,username'
|
||||
];
|
||||
|
||||
|
@ -73,6 +72,14 @@ class EditAlbumCommand extends CommandBase
|
|||
return CommandResponse::fail($validator);
|
||||
}
|
||||
|
||||
$trackIds = explode(',', $this->_input['track_ids']);
|
||||
$trackIdsCount = count($trackIds);
|
||||
$trackDbCount = DB::table('tracks')->whereIn('id', $trackIds)->count();
|
||||
|
||||
if ($trackDbCount != $trackIdsCount) {
|
||||
return CommandResponse::fail("Track IDs invalid");
|
||||
}
|
||||
|
||||
$this->_album->title = $this->_input['title'];
|
||||
$this->_album->description = $this->_input['description'];
|
||||
|
||||
|
|
Loading…
Reference in a new issue