|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace App\Services\Validation; |
|
4
|
|
|
|
|
5
|
|
|
use App\Models\JobApplication; |
|
6
|
|
|
use Illuminate\Support\Facades\Validator; |
|
7
|
|
|
use App\Services\Validation\Rules\GovernmentEmailRule; |
|
8
|
|
|
|
|
9
|
|
|
class StrategicResponseApplicationValidator extends ApplicationValidator |
|
10
|
|
|
{ |
|
11
|
|
|
/** |
|
12
|
|
|
* OVERRIDE |
|
13
|
|
|
* |
|
14
|
|
|
* @return mixed[] |
|
15
|
|
|
*/ |
|
16
|
|
|
protected function basicInfoSimpleRules() |
|
17
|
|
|
{ |
|
18
|
|
|
return [ |
|
19
|
|
|
'preferred_language_id' => ['required', 'exists:preferred_languages,id'], |
|
20
|
|
|
'director_name' => ['required', 'string'], |
|
21
|
|
|
'director_title' => ['required', 'string'], |
|
22
|
|
|
'director_email' => ['required', 'email:rfc', 'max:191'], |
|
23
|
|
|
'reference_name' => ['required', 'string'], |
|
24
|
|
|
'reference_title' => ['required', 'string'], |
|
25
|
|
|
'reference_email' => ['required', 'email:rfc', 'max:191'], |
|
26
|
|
|
'gov_email' => ['required', new GovernmentEmailRule], |
|
27
|
|
|
'physical_office_willing' => 'required|boolean', |
|
28
|
|
|
'security_clearance_id' => ['required', 'exists:security_clearances,id'], |
|
29
|
|
|
]; |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
public $experienceRules = []; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* OVERRIDE |
|
36
|
|
|
* |
|
37
|
|
|
* @return Validator |
|
38
|
|
|
*/ |
|
39
|
|
|
public function experienceValidator(JobApplication $application) |
|
40
|
|
|
{ |
|
41
|
|
|
return Validator::make([], []); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* OVERRIDE |
|
46
|
|
|
* |
|
47
|
|
|
* @return mixed[] |
|
48
|
|
|
*/ |
|
49
|
|
|
public function detailedValidatorErrors(JobApplication $application) |
|
50
|
|
|
{ |
|
51
|
|
|
return array_merge( |
|
52
|
|
|
Validator::make($application->toArray(), $this->backendRules)->errors()->all(), |
|
53
|
|
|
$this->basicsValidator($application)->errors()->all(), |
|
54
|
|
|
$this->essentialSkillsValidator($application)->errors()->all(), |
|
55
|
|
|
$this->affirmationValidator($application)->errors()->all() |
|
56
|
|
|
); |
|
57
|
|
|
} |
|
58
|
|
|
} |
|
59
|
|
|
|