|
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
|
2 |
|
public function authorize() |
|
|
|
|
|
|
17
|
|
|
{ |
|
18
|
2 |
|
return true; |
|
19
|
|
|
} |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* Get the validation rules that apply to the request. |
|
23
|
|
|
* |
|
24
|
|
|
* @return array |
|
|
|
|
|
|
25
|
|
|
*/ |
|
26
|
2 |
|
public function rules() |
|
|
|
|
|
|
27
|
|
|
{ |
|
28
|
2 |
|
$frequencyRule = new FrequencyRule(); |
|
29
|
|
|
return [ |
|
30
|
2 |
|
'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
|
2 |
|
'work_review_frequency_id' => ['nullable', $frequencyRule], |
|
48
|
2 |
|
'stay_late_frequency_id' => ['nullable', $frequencyRule], |
|
49
|
2 |
|
'engage_team_frequency_id' => ['nullable', $frequencyRule], |
|
50
|
2 |
|
'development_opportunity_frequency_id' => ['nullable', $frequencyRule], |
|
51
|
2 |
|
'refuse_low_value_work_frequency_id' => ['nullable', $frequencyRule], |
|
52
|
2 |
|
'years_experience' => 'nullable|numeric', |
|
53
|
|
|
|
|
54
|
2 |
|
'en.about_me' => 'nullable|string', |
|
55
|
2 |
|
'en.greatest_accomplishment' => 'nullable|string', |
|
56
|
2 |
|
'en.branch' => 'nullable|string', |
|
57
|
2 |
|
'en.division' => 'nullable|string', |
|
58
|
2 |
|
'en.position' => 'nullable|string', |
|
59
|
2 |
|
'en.leadership_style' => 'nullable|string', |
|
60
|
2 |
|
'en.employee_learning' => 'nullable|string', |
|
61
|
2 |
|
'en.expectations' => 'nullable|string', |
|
62
|
2 |
|
'en.education' => 'nullable|string', |
|
63
|
2 |
|
'en.career_journey' => 'nullable|string', |
|
64
|
2 |
|
'en.learning_path' => 'nullable|string', |
|
65
|
|
|
|
|
66
|
2 |
|
'fr.about_me' => 'nullable|string', |
|
67
|
2 |
|
'fr.greatest_accomplishment' => 'nullable|string', |
|
68
|
2 |
|
'fr.branch' => 'nullable|string', |
|
69
|
2 |
|
'fr.division' => 'nullable|string', |
|
70
|
2 |
|
'fr.position' => 'nullable|string', |
|
71
|
2 |
|
'fr.leadership_style' => 'nullable|string', |
|
72
|
2 |
|
'fr.employee_learning' => 'nullable|string', |
|
73
|
2 |
|
'fr.expectations' => 'nullable|string', |
|
74
|
2 |
|
'fr.education' => 'nullable|string', |
|
75
|
2 |
|
'fr.career_journey' => 'nullable|string', |
|
76
|
2 |
|
'fr.learning_path' => 'nullable|string', |
|
77
|
|
|
]; |
|
78
|
|
|
} |
|
79
|
|
|
} |
|
80
|
|
|
|