KTV/app/Http/Requests/OrderSongRequest.php
allen.yan 1bb201bacb 202508201150
包廂狀態加入 RoomSession 表
點播歌曲加入到DB
2025-08-20 11:54:10 +08:00

33 lines
1.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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',
];
}
}