@@ -46,7 +46,7 @@ |
||
| 46 | 46 | // debugbar()->debug($value); |
| 47 | 47 | // debugbar()->debug($this->attributeName); |
| 48 | 48 | // debugbar()->debug($this->attributeValue); |
| 49 | - return $this->array_any($value, function ($object) { |
|
| 49 | + return $this->array_any($value, function($object){ |
|
| 50 | 50 | return $object[$this->attributeName] == $this->attributeValue; |
| 51 | 51 | }); |
| 52 | 52 | } |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | // debugbar()->debug($value); |
| 47 | 47 | // debugbar()->debug($this->attributeName); |
| 48 | 48 | // debugbar()->debug($this->attributeValue); |
| 49 | - return $this->array_any($value, function ($object) { |
|
| 49 | + return $this->array_any($value, function ($object){ |
|
| 50 | 50 | return $object[$this->attributeName] == $this->attributeValue; |
| 51 | 51 | }); |
| 52 | 52 | } |
@@ -25,13 +25,13 @@ |
||
| 25 | 25 | //Validate basic data is filled in |
| 26 | 26 | Validator::make($courseValidator->getAttributes(), [ |
| 27 | 27 | 'applicant_id' => [ |
| 28 | - 'required', |
|
| 28 | + 'required', |
|
| 29 | 29 | Rule::in($applicant_ids->toArray()), |
| 30 | - ], |
|
| 31 | - 'course_status_id' => [ |
|
| 32 | - 'required', |
|
| 30 | + ], |
|
| 31 | + 'course_status_id' => [ |
|
| 32 | + 'required', |
|
| 33 | 33 | Rule::in($this->course_status_ids->toArray()), |
| 34 | - ] |
|
| 34 | + ] |
|
| 35 | 35 | |
| 36 | 36 | ])->validate(); |
| 37 | 37 | } |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | use App\Models\Applicant; |
| 8 | 8 | use App\Services\Validation\Rules\UniqueApplicantSkillRule; |
| 9 | 9 | class CourseValidator |
| 10 | -{ |
|
| 10 | +{ |
|
| 11 | 11 | |
| 12 | 12 | protected $applicant; |
| 13 | 13 | protected $course_status_id; |
@@ -7,17 +7,17 @@ discard block |
||
| 7 | 7 | use Illuminate\Support\Facades\Validator; |
| 8 | 8 | use Illuminate\Validation\Rule; |
| 9 | 9 | |
| 10 | -class JobApplicationAnswerValidator { |
|
| 10 | +class JobApplicationAnswerValidator{ |
|
| 11 | 11 | |
| 12 | 12 | protected $application; |
| 13 | 13 | protected $questionIds; |
| 14 | 14 | |
| 15 | - public function __construct(JobApplication $application) { |
|
| 15 | + public function __construct(JobApplication $application){ |
|
| 16 | 16 | $this->application = $application; |
| 17 | 17 | $this->questionIds = $application->job_poster->job_poster_questions->pluck('id')->toArray(); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - public function rules() { |
|
| 20 | + public function rules(){ |
|
| 21 | 21 | $rules = [ |
| 22 | 22 | 'answer' => 'required|string', |
| 23 | 23 | 'job_poster_question_id' => [ |
@@ -32,17 +32,17 @@ discard block |
||
| 32 | 32 | return $rules; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public function validator(JobApplicationAnswer $answer) { |
|
| 35 | + public function validator(JobApplicationAnswer $answer){ |
|
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | return Validator::make($answer->toArray(), $this->rules()); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function validate(JobApplicationAnswer $answer) { |
|
| 41 | + public function validate(JobApplicationAnswer $answer){ |
|
| 42 | 42 | return $this->validator($answer)->validate(); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - public function isComplete(JobApplicationAnswer $answer) { |
|
| 45 | + public function isComplete(JobApplicationAnswer $answer){ |
|
| 46 | 46 | return $this->validator($answer)->passes(); |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -7,17 +7,20 @@ discard block |
||
| 7 | 7 | use Illuminate\Support\Facades\Validator; |
| 8 | 8 | use Illuminate\Validation\Rule; |
| 9 | 9 | |
| 10 | -class JobApplicationAnswerValidator { |
|
| 10 | +class JobApplicationAnswerValidator |
|
| 11 | +{ |
|
| 11 | 12 | |
| 12 | 13 | protected $application; |
| 13 | 14 | protected $questionIds; |
| 14 | 15 | |
| 15 | - public function __construct(JobApplication $application) { |
|
| 16 | + public function __construct(JobApplication $application) |
|
| 17 | + { |
|
| 16 | 18 | $this->application = $application; |
| 17 | 19 | $this->questionIds = $application->job_poster->job_poster_questions->pluck('id')->toArray(); |
| 18 | 20 | } |
| 19 | 21 | |
| 20 | - public function rules() { |
|
| 22 | + public function rules() |
|
| 23 | + { |
|
| 21 | 24 | $rules = [ |
| 22 | 25 | 'answer' => 'required|string', |
| 23 | 26 | 'job_poster_question_id' => [ |
@@ -32,17 +35,20 @@ discard block |
||
| 32 | 35 | return $rules; |
| 33 | 36 | } |
| 34 | 37 | |
| 35 | - public function validator(JobApplicationAnswer $answer) { |
|
| 38 | + public function validator(JobApplicationAnswer $answer) |
|
| 39 | + { |
|
| 36 | 40 | |
| 37 | 41 | |
| 38 | 42 | return Validator::make($answer->toArray(), $this->rules()); |
| 39 | 43 | } |
| 40 | 44 | |
| 41 | - public function validate(JobApplicationAnswer $answer) { |
|
| 45 | + public function validate(JobApplicationAnswer $answer) |
|
| 46 | + { |
|
| 42 | 47 | return $this->validator($answer)->validate(); |
| 43 | 48 | } |
| 44 | 49 | |
| 45 | - public function isComplete(JobApplicationAnswer $answer) { |
|
| 50 | + public function isComplete(JobApplicationAnswer $answer) |
|
| 51 | + { |
|
| 46 | 52 | return $this->validator($answer)->passes(); |
| 47 | 53 | } |
| 48 | 54 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | ]; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - public function messages() { |
|
| 24 | + public function messages(){ |
|
| 25 | 25 | return Lang::get('validation.custom.password'); |
| 26 | 26 | } |
| 27 | 27 | } |
@@ -21,7 +21,8 @@ |
||
| 21 | 21 | ]; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - public function messages() { |
|
| 24 | + public function messages() |
|
| 25 | + { |
|
| 25 | 26 | return Lang::get('validation.custom.password'); |
| 26 | 27 | } |
| 27 | 28 | } |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function validator(SkillDeclaration $skillDeclaration) { |
|
| 32 | + public function validator(SkillDeclaration $skillDeclaration){ |
|
| 33 | 33 | $uniqueSkillRule = new UniqueApplicantSkillRule($this->applicant, $skillDeclaration->id); |
| 34 | 34 | |
| 35 | 35 | //Validate basic data is filled in |
@@ -29,7 +29,8 @@ |
||
| 29 | 29 | |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function validator(SkillDeclaration $skillDeclaration) { |
|
| 32 | + public function validator(SkillDeclaration $skillDeclaration) |
|
| 33 | + { |
|
| 33 | 34 | $uniqueSkillRule = new UniqueApplicantSkillRule($this->applicant, $skillDeclaration->id); |
| 34 | 35 | |
| 35 | 36 | //Validate basic data is filled in |
@@ -13,19 +13,19 @@ discard block |
||
| 13 | 13 | use App\Services\Validation\Rules\ContainsObjectWithAttributeRule; |
| 14 | 14 | use App\Services\Validation\JobApplicationAnswerValidator; |
| 15 | 15 | |
| 16 | -class ApplicationValidator { |
|
| 16 | +class ApplicationValidator{ |
|
| 17 | 17 | |
| 18 | 18 | protected $citizenship_ids; |
| 19 | 19 | protected $veteran_status_ids; |
| 20 | 20 | protected $preferred_language_ids; |
| 21 | 21 | |
| 22 | - public function __construct() { |
|
| 22 | + public function __construct(){ |
|
| 23 | 23 | $this->citizenship_ids = CitizenshipDeclaration::all()->pluck('id')->toArray(); |
| 24 | 24 | $this->veteran_status_ids = VeteranStatus::all()->pluck('id')->toArray(); |
| 25 | 25 | $this->preferred_language_ids = PreferredLanguage::all()->pluck('id')->toArray(); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - public function validate(JobApplication $application) { |
|
| 28 | + public function validate(JobApplication $application){ |
|
| 29 | 29 | |
| 30 | 30 | $backendRules = [ |
| 31 | 31 | 'job_poster_id' => 'required', |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | return $newArray; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - protected function addNestedValidatorRules($nestedAttribute, $validatorRules, $rules = []) { |
|
| 78 | + protected function addNestedValidatorRules($nestedAttribute, $validatorRules, $rules = []){ |
|
| 79 | 79 | // prepend the attribute name of each validator rule with the nested attribute name |
| 80 | 80 | $newRules = $this->arrayMapKeys(function($key) use ($nestedAttribute) { |
| 81 | 81 | return implode('.', [$nestedAttribute, $key]); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | return $rules; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - public function basicsValidator(JobApplication $application) { |
|
| 89 | + public function basicsValidator(JobApplication $application){ |
|
| 90 | 90 | // Validate the fields common to every application |
| 91 | 91 | $rules = [ |
| 92 | 92 | 'language_requirement_confirmed' => ['required', 'boolean'], |
@@ -100,14 +100,14 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | // Validate that each question has been answered |
| 102 | 102 | $jobPosterQuestionRules = []; |
| 103 | - foreach($application->job_poster->job_poster_questions as $question) { |
|
| 103 | + foreach ($application->job_poster->job_poster_questions as $question) { |
|
| 104 | 104 | $jobPosterQuestionRules[] = new ContainsObjectWithAttributeRule('job_poster_question_id', $question->id); |
| 105 | 105 | } |
| 106 | 106 | $rules['job_application_answers'] = $jobPosterQuestionRules; |
| 107 | 107 | $answerValidatorFactory = new JobApplicationAnswerValidator($application); |
| 108 | 108 | |
| 109 | 109 | //Validate that each answer is complete |
| 110 | - foreach($application->job_application_answers as $key=>$answer) { |
|
| 110 | + foreach ($application->job_application_answers as $key=>$answer) { |
|
| 111 | 111 | $attribute = implode('.', ['job_application_answers', $key]); |
| 112 | 112 | $rules = $this->addNestedValidatorRules($attribute, $answerValidatorFactory->rules(), $rules); |
| 113 | 113 | } |
@@ -116,26 +116,26 @@ discard block |
||
| 116 | 116 | return $validator; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - public function basicsComplete(JobApplication $application) { |
|
| 119 | + public function basicsComplete(JobApplication $application){ |
|
| 120 | 120 | $validator = $this->basicsValidator($application); |
| 121 | 121 | return $validator->passes(); |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - public function experienceValidator(JobApplication $application) { |
|
| 124 | + public function experienceValidator(JobApplication $application){ |
|
| 125 | 125 | $rules = ['experience_saved' => 'required|boolean|accepted']; |
| 126 | 126 | return Validator::make($application->toArray(), $rules); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - public function experienceComplete(JobApplication $application) { |
|
| 129 | + public function experienceComplete(JobApplication $application){ |
|
| 130 | 130 | return $this->experienceValidator($application)->passes(); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - protected function skillsValidator(JobApplication $application, $criteria_type) { |
|
| 133 | + protected function skillsValidator(JobApplication $application, $criteria_type){ |
|
| 134 | 134 | $rules = []; |
| 135 | 135 | |
| 136 | 136 | $skillDeclarationRules = []; |
| 137 | 137 | $criteriaTypeId = CriteriaType::where('name', $criteria_type)->firstOrFail()->id; |
| 138 | - foreach($application->job_poster->criteria->where('criteria_type_id', $criteriaTypeId) as $criteria) { |
|
| 138 | + foreach ($application->job_poster->criteria->where('criteria_type_id', $criteriaTypeId) as $criteria) { |
|
| 139 | 139 | //Validate that every essential skill has a corresponding declaration |
| 140 | 140 | $skillDeclarationRules[] = new ContainsObjectWithAttributeRule('skill_id', $criteria->skill_id); |
| 141 | 141 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | //Validate that those declarations are complete |
| 146 | 146 | $skilDeclarationValidatorFactory = new SkillDeclarationValidator($application->applicant); |
| 147 | 147 | $relevantSkillIds = $application->job_poster->criteria->where('criteria_type_id', $criteriaTypeId)->pluck('skill_id'); |
| 148 | - foreach( $application->skill_declarations as $key=>$declaration) { |
|
| 148 | + foreach ($application->skill_declarations as $key=>$declaration) { |
|
| 149 | 149 | if ($relevantSkillIds->contains($declaration->skill_id)) { |
| 150 | 150 | $attribute = implode('.', ['skill_declarations', $key]); |
| 151 | 151 | $skillDeclarationValidator = $skilDeclarationValidatorFactory->validator($declaration); |
@@ -157,23 +157,23 @@ discard block |
||
| 157 | 157 | return $validator; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - public function essentialSkillsValidator(JobApplication $application) { |
|
| 160 | + public function essentialSkillsValidator(JobApplication $application){ |
|
| 161 | 161 | return $this->skillsValidator($application, 'essential'); |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - public function essentialSkillsComplete(JobApplication $application) { |
|
| 164 | + public function essentialSkillsComplete(JobApplication $application){ |
|
| 165 | 165 | return $this->essentialSkillsValidator($application)->passes(); |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - public function assetSkillsValidator(JobApplication $application) { |
|
| 168 | + public function assetSkillsValidator(JobApplication $application){ |
|
| 169 | 169 | return $this->skillsValidator($application, 'asset'); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - public function assetSkillsComplete(JobApplication $application) { |
|
| 172 | + public function assetSkillsComplete(JobApplication $application){ |
|
| 173 | 173 | return $this->assetSkillsValidator($application)->passes(); |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - public function affirmationValidator(JobApplication $application) { |
|
| 176 | + public function affirmationValidator(JobApplication $application){ |
|
| 177 | 177 | $rules = [ |
| 178 | 178 | 'submission_signature' => [ |
| 179 | 179 | 'required', |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | return Validator::make($application->toArray(), $rules); |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - public function affirmationComplete(JobApplication $application) { |
|
| 192 | + public function affirmationComplete(JobApplication $application){ |
|
| 193 | 193 | return $this->affirmationValidator($application)->passes(); |
| 194 | 194 | } |
| 195 | 195 | } |
@@ -13,19 +13,22 @@ discard block |
||
| 13 | 13 | use App\Services\Validation\Rules\ContainsObjectWithAttributeRule; |
| 14 | 14 | use App\Services\Validation\JobApplicationAnswerValidator; |
| 15 | 15 | |
| 16 | -class ApplicationValidator { |
|
| 16 | +class ApplicationValidator |
|
| 17 | +{ |
|
| 17 | 18 | |
| 18 | 19 | protected $citizenship_ids; |
| 19 | 20 | protected $veteran_status_ids; |
| 20 | 21 | protected $preferred_language_ids; |
| 21 | 22 | |
| 22 | - public function __construct() { |
|
| 23 | + public function __construct() |
|
| 24 | + { |
|
| 23 | 25 | $this->citizenship_ids = CitizenshipDeclaration::all()->pluck('id')->toArray(); |
| 24 | 26 | $this->veteran_status_ids = VeteranStatus::all()->pluck('id')->toArray(); |
| 25 | 27 | $this->preferred_language_ids = PreferredLanguage::all()->pluck('id')->toArray(); |
| 26 | 28 | } |
| 27 | 29 | |
| 28 | - public function validate(JobApplication $application) { |
|
| 30 | + public function validate(JobApplication $application) |
|
| 31 | + { |
|
| 29 | 32 | |
| 30 | 33 | $backendRules = [ |
| 31 | 34 | 'job_poster_id' => 'required', |
@@ -75,9 +78,10 @@ discard block |
||
| 75 | 78 | return $newArray; |
| 76 | 79 | } |
| 77 | 80 | |
| 78 | - protected function addNestedValidatorRules($nestedAttribute, $validatorRules, $rules = []) { |
|
| 81 | + protected function addNestedValidatorRules($nestedAttribute, $validatorRules, $rules = []) |
|
| 82 | + { |
|
| 79 | 83 | // prepend the attribute name of each validator rule with the nested attribute name |
| 80 | - $newRules = $this->arrayMapKeys(function($key) use ($nestedAttribute) { |
|
| 84 | + $newRules = $this->arrayMapKeys(function($key) use ($nestedAttribute){ |
|
| 81 | 85 | return implode('.', [$nestedAttribute, $key]); |
| 82 | 86 | }, |
| 83 | 87 | $validatorRules); |
@@ -86,7 +90,8 @@ discard block |
||
| 86 | 90 | return $rules; |
| 87 | 91 | } |
| 88 | 92 | |
| 89 | - public function basicsValidator(JobApplication $application) { |
|
| 93 | + public function basicsValidator(JobApplication $application) |
|
| 94 | + { |
|
| 90 | 95 | // Validate the fields common to every application |
| 91 | 96 | $rules = [ |
| 92 | 97 | 'language_requirement_confirmed' => ['required', 'boolean'], |
@@ -116,21 +121,25 @@ discard block |
||
| 116 | 121 | return $validator; |
| 117 | 122 | } |
| 118 | 123 | |
| 119 | - public function basicsComplete(JobApplication $application) { |
|
| 124 | + public function basicsComplete(JobApplication $application) |
|
| 125 | + { |
|
| 120 | 126 | $validator = $this->basicsValidator($application); |
| 121 | 127 | return $validator->passes(); |
| 122 | 128 | } |
| 123 | 129 | |
| 124 | - public function experienceValidator(JobApplication $application) { |
|
| 130 | + public function experienceValidator(JobApplication $application) |
|
| 131 | + { |
|
| 125 | 132 | $rules = ['experience_saved' => 'required|boolean|accepted']; |
| 126 | 133 | return Validator::make($application->toArray(), $rules); |
| 127 | 134 | } |
| 128 | 135 | |
| 129 | - public function experienceComplete(JobApplication $application) { |
|
| 136 | + public function experienceComplete(JobApplication $application) |
|
| 137 | + { |
|
| 130 | 138 | return $this->experienceValidator($application)->passes(); |
| 131 | 139 | } |
| 132 | 140 | |
| 133 | - protected function skillsValidator(JobApplication $application, $criteria_type) { |
|
| 141 | + protected function skillsValidator(JobApplication $application, $criteria_type) |
|
| 142 | + { |
|
| 134 | 143 | $rules = []; |
| 135 | 144 | |
| 136 | 145 | $skillDeclarationRules = []; |
@@ -157,23 +166,28 @@ discard block |
||
| 157 | 166 | return $validator; |
| 158 | 167 | } |
| 159 | 168 | |
| 160 | - public function essentialSkillsValidator(JobApplication $application) { |
|
| 169 | + public function essentialSkillsValidator(JobApplication $application) |
|
| 170 | + { |
|
| 161 | 171 | return $this->skillsValidator($application, 'essential'); |
| 162 | 172 | } |
| 163 | 173 | |
| 164 | - public function essentialSkillsComplete(JobApplication $application) { |
|
| 174 | + public function essentialSkillsComplete(JobApplication $application) |
|
| 175 | + { |
|
| 165 | 176 | return $this->essentialSkillsValidator($application)->passes(); |
| 166 | 177 | } |
| 167 | 178 | |
| 168 | - public function assetSkillsValidator(JobApplication $application) { |
|
| 179 | + public function assetSkillsValidator(JobApplication $application) |
|
| 180 | + { |
|
| 169 | 181 | return $this->skillsValidator($application, 'asset'); |
| 170 | 182 | } |
| 171 | 183 | |
| 172 | - public function assetSkillsComplete(JobApplication $application) { |
|
| 184 | + public function assetSkillsComplete(JobApplication $application) |
|
| 185 | + { |
|
| 173 | 186 | return $this->assetSkillsValidator($application)->passes(); |
| 174 | 187 | } |
| 175 | 188 | |
| 176 | - public function affirmationValidator(JobApplication $application) { |
|
| 189 | + public function affirmationValidator(JobApplication $application) |
|
| 190 | + { |
|
| 177 | 191 | $rules = [ |
| 178 | 192 | 'submission_signature' => [ |
| 179 | 193 | 'required', |
@@ -189,7 +203,8 @@ discard block |
||
| 189 | 203 | return Validator::make($application->toArray(), $rules); |
| 190 | 204 | } |
| 191 | 205 | |
| 192 | - public function affirmationComplete(JobApplication $application) { |
|
| 206 | + public function affirmationComplete(JobApplication $application) |
|
| 207 | + { |
|
| 193 | 208 | return $this->affirmationValidator($application)->passes(); |
| 194 | 209 | } |
| 195 | 210 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | public function getFunctions(): array |
| 14 | 14 | { |
| 15 | 15 | return [ |
| 16 | - new Twig_SimpleFunction('handleNullState', [$this, 'handleNullState']), |
|
| 16 | + new Twig_SimpleFunction('handleNullState', [$this, 'handleNullState']), |
|
| 17 | 17 | ]; |
| 18 | 18 | } |
| 19 | 19 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | * |
| 20 | 20 | * @property \App\Models\WorkplacePhotoCaption $workplace_photo_caption |
| 21 | 21 | */ |
| 22 | -class WorkplacePhoto extends BaseModel { |
|
| 22 | +class WorkplacePhoto extends BaseModel{ |
|
| 23 | 23 | |
| 24 | 24 | protected $casts = [ |
| 25 | 25 | 'image' => 'boolean', |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | 'image' |
| 30 | 30 | ]; |
| 31 | 31 | |
| 32 | - public function workplace_photo_caption() { |
|
| 32 | + public function workplace_photo_caption(){ |
|
| 33 | 33 | return $this->hasOne(\App\Models\WorkplacePhotoCaption::class); |
| 34 | 34 | } |
| 35 | 35 | |
@@ -19,7 +19,8 @@ discard block |
||
| 19 | 19 | * |
| 20 | 20 | * @property \App\Models\WorkplacePhotoCaption $workplace_photo_caption |
| 21 | 21 | */ |
| 22 | -class WorkplacePhoto extends BaseModel { |
|
| 22 | +class WorkplacePhoto extends BaseModel |
|
| 23 | +{ |
|
| 23 | 24 | |
| 24 | 25 | protected $casts = [ |
| 25 | 26 | 'image' => 'boolean', |
@@ -29,7 +30,8 @@ discard block |
||
| 29 | 30 | 'image' |
| 30 | 31 | ]; |
| 31 | 32 | |
| 32 | - public function workplace_photo_caption() { |
|
| 33 | + public function workplace_photo_caption() |
|
| 34 | + { |
|
| 33 | 35 | return $this->hasOne(\App\Models\WorkplacePhotoCaption::class); |
| 34 | 36 | } |
| 35 | 37 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | * @property \Illuminate\Database\Eloquent\Collection $skill_declarations |
| 47 | 47 | * @property \App\Models\ApplicationReview $application_review |
| 48 | 48 | */ |
| 49 | -class JobApplication extends BaseModel { |
|
| 49 | +class JobApplication extends BaseModel{ |
|
| 50 | 50 | |
| 51 | 51 | use Notifiable; |
| 52 | 52 | |
@@ -85,51 +85,51 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | protected $appends = ['meets_essential_criteria']; |
| 87 | 87 | |
| 88 | - protected function createApplicantSnapshot($applicant_id) { |
|
| 88 | + protected function createApplicantSnapshot($applicant_id){ |
|
| 89 | 89 | $applicant = Applicant::where('id', $applicant_id)->firstOrFail(); |
| 90 | 90 | |
| 91 | 91 | $snapshot = $applicant->replicate(); |
| 92 | 92 | |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - public function applicant() { |
|
| 95 | + public function applicant(){ |
|
| 96 | 96 | return $this->belongsTo(\App\Models\Applicant::class); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - public function applicant_snapshot() { |
|
| 99 | + public function applicant_snapshot(){ |
|
| 100 | 100 | return $this->belongsTo(\App\Models\Applicant::class, 'applicant_snapshot_id'); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - public function application_status() { |
|
| 103 | + public function application_status(){ |
|
| 104 | 104 | return $this->belongsTo(\App\Models\Lookup\ApplicationStatus::class); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - public function citizenship_declaration() { |
|
| 107 | + public function citizenship_declaration(){ |
|
| 108 | 108 | return $this->belongsTo(\App\Models\Lookup\CitizenshipDeclaration::class); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - public function veteran_status() { |
|
| 111 | + public function veteran_status(){ |
|
| 112 | 112 | return $this->belongsTo(\App\Models\Lookup\VeteranStatus::class); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - public function preferred_language() { |
|
| 115 | + public function preferred_language(){ |
|
| 116 | 116 | return $this->belongsTo(\App\Models\Lookup\PreferredLanguage::class); |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - public function job_poster() { |
|
| 119 | + public function job_poster(){ |
|
| 120 | 120 | return $this->belongsTo(\App\Models\JobPoster::class); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - public function job_application_answers() { |
|
| 123 | + public function job_application_answers(){ |
|
| 124 | 124 | return $this->hasMany(\App\Models\JobApplicationAnswer::class); |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - public function skill_declarations() { |
|
| 127 | + public function skill_declarations(){ |
|
| 128 | 128 | return $this->applicant->skill_declarations() |
| 129 | 129 | ->whereIn('skill_id', $this->job_poster->criteria->pluck('skill_id')); |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - public function application_review() { |
|
| 132 | + public function application_review(){ |
|
| 133 | 133 | return $this->hasOne(ApplicationReview::class); |
| 134 | 134 | } |
| 135 | 135 | |
@@ -146,11 +146,11 @@ discard block |
||
| 146 | 146 | * |
| 147 | 147 | * @return string $status 'complete', 'incomplete' or 'error' |
| 148 | 148 | */ |
| 149 | - public function getSectionStatus(string $section) { |
|
| 149 | + public function getSectionStatus(string $section){ |
|
| 150 | 150 | //TODO: determine whether sections are complete or invalid |
| 151 | 151 | $validator = new ApplicationValidator(); |
| 152 | 152 | $status = 'incomplete'; |
| 153 | - switch($section) { |
|
| 153 | + switch ($section) { |
|
| 154 | 154 | case 'basics': |
| 155 | 155 | if ($validator->basicsComplete($this)) { |
| 156 | 156 | $status = 'complete'; |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | public function meetsEssentialCriteria(): bool |
| 202 | 202 | { |
| 203 | 203 | $essentialCriteria = $this->job_poster->criteria->filter( |
| 204 | - function ($value, $key) { |
|
| 204 | + function($value, $key){ |
|
| 205 | 205 | return $value->criteria_type->name == 'essential'; |
| 206 | 206 | } |
| 207 | 207 | ); |
@@ -46,7 +46,8 @@ discard block |
||
| 46 | 46 | * @property \Illuminate\Database\Eloquent\Collection $skill_declarations |
| 47 | 47 | * @property \App\Models\ApplicationReview $application_review |
| 48 | 48 | */ |
| 49 | -class JobApplication extends BaseModel { |
|
| 49 | +class JobApplication extends BaseModel |
|
| 50 | +{ |
|
| 50 | 51 | |
| 51 | 52 | use Notifiable; |
| 52 | 53 | |
@@ -85,51 +86,62 @@ discard block |
||
| 85 | 86 | */ |
| 86 | 87 | protected $appends = ['meets_essential_criteria']; |
| 87 | 88 | |
| 88 | - protected function createApplicantSnapshot($applicant_id) { |
|
| 89 | + protected function createApplicantSnapshot($applicant_id) |
|
| 90 | + { |
|
| 89 | 91 | $applicant = Applicant::where('id', $applicant_id)->firstOrFail(); |
| 90 | 92 | |
| 91 | 93 | $snapshot = $applicant->replicate(); |
| 92 | 94 | |
| 93 | 95 | } |
| 94 | 96 | |
| 95 | - public function applicant() { |
|
| 97 | + public function applicant() |
|
| 98 | + { |
|
| 96 | 99 | return $this->belongsTo(\App\Models\Applicant::class); |
| 97 | 100 | } |
| 98 | 101 | |
| 99 | - public function applicant_snapshot() { |
|
| 102 | + public function applicant_snapshot() |
|
| 103 | + { |
|
| 100 | 104 | return $this->belongsTo(\App\Models\Applicant::class, 'applicant_snapshot_id'); |
| 101 | 105 | } |
| 102 | 106 | |
| 103 | - public function application_status() { |
|
| 107 | + public function application_status() |
|
| 108 | + { |
|
| 104 | 109 | return $this->belongsTo(\App\Models\Lookup\ApplicationStatus::class); |
| 105 | 110 | } |
| 106 | 111 | |
| 107 | - public function citizenship_declaration() { |
|
| 112 | + public function citizenship_declaration() |
|
| 113 | + { |
|
| 108 | 114 | return $this->belongsTo(\App\Models\Lookup\CitizenshipDeclaration::class); |
| 109 | 115 | } |
| 110 | 116 | |
| 111 | - public function veteran_status() { |
|
| 117 | + public function veteran_status() |
|
| 118 | + { |
|
| 112 | 119 | return $this->belongsTo(\App\Models\Lookup\VeteranStatus::class); |
| 113 | 120 | } |
| 114 | 121 | |
| 115 | - public function preferred_language() { |
|
| 122 | + public function preferred_language() |
|
| 123 | + { |
|
| 116 | 124 | return $this->belongsTo(\App\Models\Lookup\PreferredLanguage::class); |
| 117 | 125 | } |
| 118 | 126 | |
| 119 | - public function job_poster() { |
|
| 127 | + public function job_poster() |
|
| 128 | + { |
|
| 120 | 129 | return $this->belongsTo(\App\Models\JobPoster::class); |
| 121 | 130 | } |
| 122 | 131 | |
| 123 | - public function job_application_answers() { |
|
| 132 | + public function job_application_answers() |
|
| 133 | + { |
|
| 124 | 134 | return $this->hasMany(\App\Models\JobApplicationAnswer::class); |
| 125 | 135 | } |
| 126 | 136 | |
| 127 | - public function skill_declarations() { |
|
| 137 | + public function skill_declarations() |
|
| 138 | + { |
|
| 128 | 139 | return $this->applicant->skill_declarations() |
| 129 | 140 | ->whereIn('skill_id', $this->job_poster->criteria->pluck('skill_id')); |
| 130 | 141 | } |
| 131 | 142 | |
| 132 | - public function application_review() { |
|
| 143 | + public function application_review() |
|
| 144 | + { |
|
| 133 | 145 | return $this->hasOne(ApplicationReview::class); |
| 134 | 146 | } |
| 135 | 147 | |
@@ -146,7 +158,8 @@ discard block |
||
| 146 | 158 | * |
| 147 | 159 | * @return string $status 'complete', 'incomplete' or 'error' |
| 148 | 160 | */ |
| 149 | - public function getSectionStatus(string $section) { |
|
| 161 | + public function getSectionStatus(string $section) |
|
| 162 | + { |
|
| 150 | 163 | //TODO: determine whether sections are complete or invalid |
| 151 | 164 | $validator = new ApplicationValidator(); |
| 152 | 165 | $status = 'incomplete'; |
@@ -201,7 +214,7 @@ discard block |
||
| 201 | 214 | public function meetsEssentialCriteria(): bool |
| 202 | 215 | { |
| 203 | 216 | $essentialCriteria = $this->job_poster->criteria->filter( |
| 204 | - function ($value, $key) { |
|
| 217 | + function ($value, $key){ |
|
| 205 | 218 | return $value->criteria_type->name == 'essential'; |
| 206 | 219 | } |
| 207 | 220 | ); |