43 lines
1.4 KiB
PHP
43 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Admin;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class UpdateEventRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
$event = $this->route('event');
|
|
$eventId = $event?->id ?? $this->route('id');
|
|
|
|
return [
|
|
'name' => ['required', 'string', 'max:255'],
|
|
'description' => ['nullable', 'string', 'max:5000'],
|
|
'slug' => [
|
|
'nullable',
|
|
'string',
|
|
'max:100',
|
|
'regex:/^[a-z0-9]+(?:-[a-z0-9]+)*$/',
|
|
Rule::unique('events', 'slug')->ignore($eventId),
|
|
],
|
|
'google_drive_folder_id' => ['nullable', 'string', 'max:255'],
|
|
'google_drive_folder_name' => ['nullable', 'string', 'max:255'],
|
|
'is_active' => ['boolean'],
|
|
'upload_start_at' => ['nullable', 'date'],
|
|
'upload_end_at' => ['nullable', 'date', 'after:upload_start_at'],
|
|
'max_file_size_mb' => ['integer', 'min:1', 'max:2000'],
|
|
'allowed_extensions' => ['array'],
|
|
'allowed_extensions.*' => ['string', 'in:mp4,mov,avi,mkv,webm,jpg,jpeg,png'],
|
|
'require_password' => ['boolean'],
|
|
'upload_password' => ['nullable', 'string', 'min:4', 'max:100'],
|
|
];
|
|
}
|
|
}
|