2022-08-10 14:56:01 +00:00
|
|
|
<?php
|
|
|
|
|
2023-06-05 21:46:41 +00:00
|
|
|
namespace App\Http\Requests\API;
|
2022-08-10 14:56:01 +00:00
|
|
|
|
|
|
|
use App\Models\Playlist;
|
2024-03-27 09:53:05 +00:00
|
|
|
use App\Rules\AllPlaylistsAreAccessibleBy;
|
2022-08-10 14:56:01 +00:00
|
|
|
use Illuminate\Validation\Rule;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @property-read array<int>|int $playlists
|
|
|
|
*/
|
|
|
|
class PlaylistFolderPlaylistStoreRequest extends Request
|
|
|
|
{
|
|
|
|
/** @return array<mixed> */
|
|
|
|
public function rules(): array
|
|
|
|
{
|
|
|
|
return [
|
2024-01-10 20:04:37 +00:00
|
|
|
'playlists' => [
|
|
|
|
'required',
|
|
|
|
'array',
|
2024-03-27 09:53:05 +00:00
|
|
|
new AllPlaylistsAreAccessibleBy($this->user()),
|
2024-01-10 20:04:37 +00:00
|
|
|
Rule::exists(Playlist::class, 'id'),
|
|
|
|
],
|
2022-08-10 14:56:01 +00:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|