Total Complexity | 3 |
Total Lines | 34 |
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 | * @return bool |
||
16 | */ |
||
17 | public function authorize() |
||
18 | { |
||
19 | return $this->user()->can('create', Sermon::class); |
||
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 | 'title' => SermonHelper::$titleValidation, |
||
31 | 'preacher' => SermonHelper::$titleValidation, |
||
32 | 'main_verses' => 'required|array', |
||
33 | 'date' => 'required|date', |
||
34 | 'reference_verses' => 'array', |
||
35 | 'sermon' => 'required|string|min:50', |
||
36 | 'resource' => 'sometimes|url', |
||
37 | 'image' => 'base64image', |
||
38 | ]; |
||
39 | } |
||
40 | |||
41 | protected function failedAuthorization() |
||
44 | } |
||
45 | } |
||
46 |