mirror of
https://github.com/koel/koel
synced 2024-12-27 21:13:06 +00:00
31 lines
858 B
PHP
31 lines
858 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\API;
|
|
|
|
use App\Models\PlaylistFolder;
|
|
use App\Models\Song;
|
|
use App\Rules\ValidSmartPlaylistRulePayload;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
/**
|
|
* @property array<string> $songs
|
|
* @property-read string $name
|
|
* @property-read int|null $folder_id
|
|
* @property-read array $rules
|
|
* @property-read ?bool $own_songs_only
|
|
*/
|
|
class PlaylistStoreRequest extends Request
|
|
{
|
|
/** @return array<mixed> */
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'name' => 'required',
|
|
'songs' => 'array',
|
|
'songs.*' => [Rule::exists(Song::class, 'id')],
|
|
'rules' => ['array', 'nullable', new ValidSmartPlaylistRulePayload()],
|
|
'folder_id' => ['nullable', 'sometimes', Rule::exists(PlaylistFolder::class, 'id')],
|
|
'own_songs_only' => 'sometimes',
|
|
];
|
|
}
|
|
}
|