| Total Complexity | 4 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 9 | class UpdateRequest extends FormRequest |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * Determine if the user is authorized to make this request. |
||
| 13 | * |
||
| 14 | * @return bool |
||
| 15 | */ |
||
| 16 | public function authorize(EventsService $eventsService) |
||
| 17 | { |
||
| 18 | return $eventsService->getEvent() |
||
| 19 | && $this->user()->can('update', $eventsService->getEvent()); |
||
| 20 | } |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Get the validation rules that apply to the request. |
||
| 24 | * |
||
| 25 | * @return array |
||
| 26 | */ |
||
| 27 | public function rules() |
||
| 28 | { |
||
| 29 | return [ |
||
| 30 | 'name' => 'required|string', |
||
| 31 | 'description' => 'required|string', |
||
| 32 | 'location' => 'required|array', |
||
| 33 | 'start' => 'required|date_format:Y-m-d H:i', |
||
| 34 | 'end' => 'required|date_format:Y-m-d H:i', |
||
| 35 | 'published' => 'required|boolean', |
||
| 36 | 'url' => 'url', |
||
| 37 | 'video_url' => 'url', |
||
| 38 | 'banner' => 'base64image', |
||
| 39 | ]; |
||
| 40 | } |
||
| 41 | |||
| 42 | public function failedAuthorization() |
||
| 45 | } |
||
| 46 | } |
||
| 47 |