51 lines
1.7 KiB
PHP
51 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Requests\Api\V1;
|
|
|
|
use App\Enums\EventStatus;
|
|
use App\Enums\EventVisibility;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
final class UpdateEventRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'title' => ['sometimes', 'string', 'max:255'],
|
|
'description' => ['nullable', 'string', 'max:5000'],
|
|
'location_id' => ['nullable', 'ulid', 'exists:locations,id'],
|
|
'customer_id' => ['nullable', 'ulid', 'exists:customers,id'],
|
|
'setlist_id' => ['nullable', 'ulid', 'exists:setlists,id'],
|
|
'event_date' => ['sometimes', 'date'],
|
|
'start_time' => ['sometimes', 'date_format:H:i'],
|
|
'end_time' => ['nullable', 'date_format:H:i'],
|
|
'load_in_time' => ['nullable', 'date_format:H:i'],
|
|
'soundcheck_time' => ['nullable', 'date_format:H:i'],
|
|
'fee' => ['nullable', 'numeric', 'min:0', 'max:999999.99'],
|
|
'currency' => ['sometimes', 'string', 'size:3'],
|
|
'status' => ['sometimes', Rule::enum(EventStatus::class)],
|
|
'visibility' => ['sometimes', Rule::enum(EventVisibility::class)],
|
|
'rsvp_deadline' => ['nullable', 'date'],
|
|
'notes' => ['nullable', 'string', 'max:5000'],
|
|
'internal_notes' => ['nullable', 'string', 'max:5000'],
|
|
'is_public_setlist' => ['sometimes', 'boolean'],
|
|
];
|
|
}
|
|
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'end_time.after' => 'The end time must be after the start time.',
|
|
];
|
|
}
|
|
}
|
|
|