33 lines
1.1 KiB
PHP
33 lines
1.1 KiB
PHP
<?php
|
||
|
||
namespace App\Http\Requests;
|
||
|
||
use Illuminate\Validation\Rule;
|
||
|
||
/**
|
||
* @OA\Schema(
|
||
* schema="OrderSongRequest",
|
||
* required={"song_id","status","api_token"},
|
||
* @OA\Property(property="song_id", type="integer", example=1),
|
||
* @OA\Property(property="status", type="string", enum={"NotPlayed", "InsertPlayback", "Skipped"},example="NotPlayed"),
|
||
* @OA\Property(property="from_by", type="string", example="介面,ERP之類的說明"),
|
||
* @OA\Property(property="api_token", type="string", example="da9cdb88a60a377bba9fc53f09dd07838eb6f4f355d63f4927c711e7aaae3104"),
|
||
* )
|
||
*/
|
||
class OrderSongRequest extends ApiRequest
|
||
{
|
||
public function rules(): array
|
||
{
|
||
return [
|
||
|
||
'api_token' => [
|
||
'required',
|
||
Rule::exists('room_sessions', 'api_token')
|
||
->where(fn ($q) => $q->whereIn('status', ['active', 'maintain']))
|
||
],
|
||
'song_id' => 'required|exists:songs,id',
|
||
'status' => 'required|in:NotPlayed,InsertPlayback,Skipped',
|
||
'from_by' => 'nullable',
|
||
];
|
||
}
|
||
} |