perf: better array+exists validation rule

This commit is contained in:
Phan An 2023-10-10 17:29:30 +02:00
parent 240794b4aa
commit ea4a42d600
2 changed files with 2 additions and 3 deletions

View file

@ -9,7 +9,7 @@ class DeleteSongsRequest extends Request
public function rules(): array
{
return [
'songs.*' => 'required|exists:songs,id',
'songs' => 'required|array|exists:songs,id',
];
}
}

View file

@ -11,8 +11,7 @@ class RemoveSongsFromPlaylistRequest extends Request
public function rules(): array
{
return [
'songs' => 'required|array',
'songs.*' => 'exists:songs,id',
'songs' => 'required|array|exists:songs,id',
];
}
}