| Total Complexity | 4 |
| Total Lines | 31 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | class CreateRequest extends FormRequest |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * Determine if the user is authorized to make this request. |
||
| 14 | * |
||
| 15 | * @param EventsService $eventsService |
||
| 16 | * @return bool |
||
| 17 | */ |
||
| 18 | public function authorize(EventsService $eventsService) |
||
| 19 | { |
||
| 20 | return $eventsService->getEvent() && $this->user()->can('view', $eventsService->getEvent()); |
||
| 21 | } |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Get the validation rules that apply to the request. |
||
| 25 | * |
||
| 26 | * @return array |
||
| 27 | */ |
||
| 28 | public function rules() |
||
| 29 | { |
||
| 30 | return [ |
||
| 31 | 'title' => 'required|string|min:2|max:15', |
||
| 32 | 'name' => 'required|string', |
||
| 33 | 'event_id' => Helper::$idValidation, |
||
| 34 | 'image' => 'required|base64image', |
||
| 35 | ]; |
||
| 36 | } |
||
| 37 | |||
| 38 | public function failedAuthorization() |
||
| 41 | } |
||
| 42 | } |
||
| 43 |