UpdateProfileRequest::rules()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 18
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 20
rs 9.6666
1
<?php
2
3
namespace FaithGen\SDK\Http\Requests\Ministry;
4
5
use FaithGen\SDK\Helpers\Helper;
6
use Illuminate\Foundation\Http\FormRequest;
7
8
class UpdateProfileRequest extends FormRequest
9
{
10
    /**
11
     * Determine if the user is authorized to make this request.
12
     *
13
     * @return bool
14
     */
15
    public function authorize()
16
    {
17
        return true;
18
    }
19
20
    /**
21
     * Get the validation rules that apply to the request.
22
     *
23
     * @return array
24
     */
25
    public function rules()
26
    {
27
        return [
28
            'name' => 'required|string|min:3',
29
            'email' => 'required|email',
30
            'phone' => 'required', //todo write a regex to serve,
31
            'links' => 'array',
32
            'color' => 'required|'.Helper::$hexColorRegex,
33
            'location' => 'array',
34
            'links.*' => 'url',
35
            'statement' => 'array',
36
            'statement.*' => 'string',
37
            'emails' => 'array',
38
            'phones' => 'array',
39
            'emails.*' => 'email',
40
            'services' => 'array',
41
            'services.*.day' => 'required|in:'.implode(',', Helper::$weekDays),
42
            'services.*.start' => ['required', 'date_format:H:i', 'regex:/^((([01]?[0-9]|2[0-3]):[0-5][0-9])?)$/'],
43
            'services.*.finish' => ['required', 'date_format:H:i', 'regex:/^((([01]?[0-9]|2[0-3]):[0-5][0-9])?)$/'],
44
            'services.*.alias' => 'nullable',
45
        ];
46
    }
47
}
48