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