30 lines
914 B
PHP
30 lines
914 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Events;
|
|
|
|
use App\Http\Requests\ApiFormRequest;
|
|
use App\Services\Events\EventCategoryService;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class EventStoreRequest extends ApiFormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return $this->user() !== null;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'event_name' => ['required', 'string', 'max:150'],
|
|
'event_category' => ['required', 'string', Rule::in(EventCategoryService::categories())],
|
|
'description' => ['nullable', 'string', 'max:2000'],
|
|
'amount' => ['required', 'numeric', 'min:0'],
|
|
'flyer' => ['nullable', 'file', 'mimes:pdf,jpg,jpeg,png'],
|
|
'expiration_date' => ['required', 'date'],
|
|
'semester' => ['required', 'string', 'max:20'],
|
|
'school_year' => ['required', 'string', 'max:20'],
|
|
];
|
|
}
|
|
}
|