Passed
Push — dev ( 69b6f1...3c5138 )
by Chris
12:29 queued 05:29
created

UpdateManagerApi::authorize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace App\Http\Requests;
4
5
use Illuminate\Foundation\Http\FormRequest;
6
use App\Services\Validation\Rules\ValidIdRule;
7
use App\Models\Lookup\Frequency;
8
use App\Models\Lookup\Department;
9
use App\Services\Validation\Rules\LinkedInUrlRule;
10
use App\Services\Validation\Rules\TwitterHandleRule;
11
12
class UpdateManagerApi extends FormRequest
13
{
14
    /**
15
     * Determine if the user is authorized to make this request.
16
     *
17
     * @return bool
1 ignored issue
show
Coding Style introduced by
Expected "boolean" but found "bool" for function return type
Loading history...
18
     */
19
    public function authorize()
20
    {
21
        return true;
22
    }
23
24
    /**
25
     * Get the validation rules that apply to the request.
26
     *
27
     * @return array
28
     */
29
    public function rules()
30
    {
31
        $frequencyRule = new ValidIdRule(Frequency::class);
32
        return [
33
            'department_id' => ['nullable', new ValidIdRule(Department::class)],
34
            'gov_email' => [
35
                'nullable',
36
                'string',
37
                'max:191',
38
                'email',
39
            ],
40
            'twitter_username' => [
41
                'nullable', // Some people may not have a handle.
42
                new TwitterHandleRule,
43
            ],
44
            'linkedin_url' => [
45
                'nullable', // Some people may not be on LinkedIn.
46
                new LinkedInUrlRule
47
            ],
48
            'work_review_frequency_id' => ['nullable', $frequencyRule],
49
            'stay_late_frequency_id' => ['nullable', $frequencyRule],
50
            'engage_team_frequency_id' => ['nullable', $frequencyRule],
51
            'development_opportunity_frequency_id' => ['nullable', $frequencyRule],
52
            'refuse_low_value_work_frequency_id' => ['nullable', $frequencyRule],
53
            'years_experience' => 'nullable|numeric',
54
55
            'en.about_me' => 'nullable|string',
56
            'en.greatest_accomplishment' => 'nullable|string',
57
            'en.branch' => 'nullable|string',
58
            'en.division' => 'nullable|string',
59
            'en.position' => 'nullable|string',
60
            'en.leadership_style' => 'nullable|string',
61
            'en.employee_learning' => 'nullable|string',
62
            'en.expectations' => 'nullable|string',
63
            'en.education' => 'nullable|string',
64
            'en.career_journey' => 'nullable|string',
65
            'en.learning_path' => 'nullable|string',
66
67
            'fr.about_me' => 'nullable|string',
68
            'fr.greatest_accomplishment' => 'nullable|string',
69
            'fr.branch' => 'nullable|string',
70
            'fr.division' => 'nullable|string',
71
            'fr.position' => 'nullable|string',
72
            'fr.leadership_style' => 'nullable|string',
73
            'fr.employee_learning' => 'nullable|string',
74
            'fr.expectations' => 'nullable|string',
75
            'fr.education' => 'nullable|string',
76
            'fr.career_journey' => 'nullable|string',
77
            'fr.learning_path' => 'nullable|string',
78
        ];
79
    }
80
}
81