Passed
Push — task/extract-localization-to-f... ( 65b263...600275 )
by Tristan
05:41 queued 10s
created

UpdateManagerProfileRequest::rules()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 17
dl 0
loc 26
rs 9.7
c 1
b 0
f 0
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 Illuminate\Validation\Rule;
11
use App\Services\Validation\Rules\PasswordCorrectRule;
12
use App\Services\Validation\Rules\PasswordFormatRule;
13
use App\Services\Validation\Rules\TwitterHandleRule;
14
15
class UpdateManagerProfileRequest extends FormRequest
16
{
17
    /**
18
     * Validator instance updated on failedValidation.
19
     *
20
     * @var \Illuminate\Contracts\Validation\Validator
21
     */
22
    public $validator = null;
23
24
    /**
25
     * Determine if the user is authorized to make this request.
26
     *
27
     * @return boolean
28
     */
29
    public function authorize()
30
    {
31
        return $this->manager !== null;
32
    }
33
34
    /**
35
     * Get the validation rules that apply to the request.
36
     *
37
     * @return array
38
     */
39
    public function rules()
40
    {
41
        return [
42
            'position.*' => 'nullable|string',
43
            'division.*' => 'nullable|string',
44
45
            'education.*' => 'nullable|string',
46
            'years_experience' => 'nullable|numeric|min:0',
47
48
49
            'career_journey.*' => 'nullable|string',
50
            'learning_path.*' => 'nullable|string',
51
            'about_me.*' => 'nullable|string',
52
53
            'twitter_username' => [
54
                'nullable', // Some people may not have a handle.
55
                new TwitterHandleRule,
56
            ],
57
            'linkedin_url' => [
58
                'nullable', // Some people may not be on LinkedIn.
59
                new LinkedInUrlRule,
60
            ],
61
62
            'leadership_style.*' => 'nullable|string',
63
            'expectations.*' => 'nullable|string',
64
            'employee_learning.*' => 'nullable|string',
65
        ];
66
    }
67
}
68