1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Http\Requests; |
4
|
|
|
|
5
|
|
|
use Illuminate\Foundation\Http\FormRequest; |
6
|
|
|
use App\Services\Validation\Rules\DepartmentRule; |
7
|
|
|
use App\Services\Validation\Rules\FrequencyRule; |
8
|
|
|
|
9
|
|
|
class UpdateManager extends FormRequest |
10
|
|
|
{ |
11
|
|
|
/** |
12
|
|
|
* Determine if the user is authorized to make this request. |
13
|
|
|
* |
14
|
|
|
* @return bool |
|
|
|
|
15
|
|
|
*/ |
16
|
|
|
public function authorize() |
|
|
|
|
17
|
|
|
{ |
18
|
|
|
return true; |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Get the validation rules that apply to the request. |
23
|
|
|
* |
24
|
|
|
* @return array |
|
|
|
|
25
|
|
|
*/ |
26
|
|
|
public function rules() |
|
|
|
|
27
|
|
|
{ |
28
|
|
|
$frequencyRule = new FrequencyRule(); |
29
|
|
|
return [ |
30
|
|
|
'department_id' => ['nullable', new DepartmentRule()], |
31
|
|
|
/* |
32
|
|
|
* Twitters Terms of Service only allows ". A username can only contain |
33
|
|
|
* alphanumeric characters (letters A-Z, numbers 0-9) with the exception |
34
|
|
|
* of underscores" |
35
|
|
|
* This regex will allow only alphamumeric characters and the underscore. |
36
|
|
|
* Keep this handy if we need to validate other usernames. |
37
|
|
|
*/ |
38
|
|
|
'twitter_username' => [ |
39
|
|
|
'nullable', //Some people may not have a handle. |
40
|
|
|
'max:15', //Per Twitter's Terms/Service. |
41
|
|
|
'regex:/^[A-Za-z0-9_]+$/', |
42
|
|
|
], |
43
|
|
|
'linkedin_url' => [ |
44
|
|
|
'nullable', // Some people may not be on LinkedIn |
45
|
|
|
'regex:/^(https:\\/\\/|http:\\/\\/)?www\\.linkedin\\.com\\/in\\/[^\\/]+(\\/)?$/', // Validation for linkedIn profile URLS only. |
46
|
|
|
], |
47
|
|
|
'work_review_frequency_id' => ['nullable', $frequencyRule], |
48
|
|
|
'stay_late_frequency_id' => ['nullable', $frequencyRule], |
49
|
|
|
'engage_team_frequency_id' => ['nullable', $frequencyRule], |
50
|
|
|
'development_opportunity_frequency_id' => ['nullable', $frequencyRule], |
51
|
|
|
'refuse_low_value_work_frequency_id' => ['nullable', $frequencyRule], |
52
|
|
|
'years_experience' => 'nullable|numeric', |
53
|
|
|
|
54
|
|
|
'en.about_me' => 'nullable|string', |
55
|
|
|
'en.greatest_accomplishment' => 'nullable|string', |
56
|
|
|
'en.branch' => 'nullable|string', |
57
|
|
|
'en.division' => 'nullable|string', |
58
|
|
|
'en.position' => 'nullable|string', |
59
|
|
|
'en.work_experience' => 'nullable|string', |
60
|
|
|
'en.education' => 'nullable|string', |
61
|
|
|
'en.leadership_style' => 'nullable|string', |
62
|
|
|
'en.employee_learning' => 'nullable|string', |
63
|
|
|
'en.expectations' => 'nullable|string', |
64
|
|
|
'en.education' => 'nullable|string', |
65
|
|
|
'en.career_journey' => 'nullable|string', |
66
|
|
|
'en.learning_path' => 'nullable|string', |
67
|
|
|
|
68
|
|
|
'fr.about_me' => 'nullable|string', |
69
|
|
|
'fr.greatest_accomplishment' => 'nullable|string', |
70
|
|
|
'fr.branch' => 'nullable|string', |
71
|
|
|
'fr.division' => 'nullable|string', |
72
|
|
|
'fr.position' => 'nullable|string', |
73
|
|
|
'fr.work_experience' => 'nullable|string', |
74
|
|
|
'fr.education' => 'nullable|string', |
75
|
|
|
'fr.leadership_style' => 'nullable|string', |
76
|
|
|
'fr.employee_learning' => 'nullable|string', |
77
|
|
|
'fr.expectations' => 'nullable|string', |
78
|
|
|
'fr.education' => 'nullable|string', |
79
|
|
|
'fr.career_journey' => 'nullable|string', |
80
|
|
|
'fr.learning_path' => 'nullable|string', |
81
|
|
|
]; |
82
|
|
|
} |
83
|
|
|
} |
84
|
|
|
|