@@ -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 | ); |
@@ -36,7 +36,8 @@ |
||
36 | 36 | */ |
37 | 37 | public function setCriterionIdAttribute($value): void |
38 | 38 | { |
39 | - if (empty($value)) { // will check for empty string, null values |
|
39 | + if (empty($value)) { |
|
40 | +// will check for empty string, null values |
|
40 | 41 | $this->attributes['criterion_id'] = null; |
41 | 42 | } else { |
42 | 43 | $this->attributes['criterion_id'] = $value; |
@@ -20,7 +20,8 @@ discard block |
||
20 | 20 | * @property \App\Models\Applicant $applicant |
21 | 21 | * @property \App\Models\Lookup\ApplicantProfileQuestion $applicant_profile_question |
22 | 22 | */ |
23 | -class ApplicantProfileAnswer extends BaseModel { |
|
23 | +class ApplicantProfileAnswer extends BaseModel |
|
24 | +{ |
|
24 | 25 | |
25 | 26 | protected $casts = [ |
26 | 27 | 'applicant_id' => 'int', |
@@ -34,11 +35,13 @@ discard block |
||
34 | 35 | 'applicant_profile_question' |
35 | 36 | ]; |
36 | 37 | |
37 | - public function applicant() { |
|
38 | + public function applicant() |
|
39 | + { |
|
38 | 40 | return $this->belongsTo(\App\Models\Applicant::class); |
39 | 41 | } |
40 | 42 | |
41 | - public function applicant_profile_question() { |
|
43 | + public function applicant_profile_question() |
|
44 | + { |
|
42 | 45 | return $this->belongsTo(\App\Models\Lookup\ApplicantProfileQuestion::class); |
43 | 46 | } |
44 | 47 |
@@ -21,7 +21,8 @@ discard block |
||
21 | 21 | * @property \App\Models\WorkEnvironment $work_environment |
22 | 22 | * @property \App\Models\WorkplacePhoto $workplace_photo |
23 | 23 | */ |
24 | -class WorkplacePhotoCaption extends BaseModel { |
|
24 | +class WorkplacePhotoCaption extends BaseModel |
|
25 | +{ |
|
25 | 26 | |
26 | 27 | protected $casts = [ |
27 | 28 | 'work_environment_id' => 'int', |
@@ -32,11 +33,13 @@ discard block |
||
32 | 33 | 'description' |
33 | 34 | ]; |
34 | 35 | |
35 | - public function work_environment() { |
|
36 | + public function work_environment() |
|
37 | + { |
|
36 | 38 | return $this->belongsTo(\App\Models\WorkEnvironment::class); |
37 | 39 | } |
38 | 40 | |
39 | - public function workplace_photo() { |
|
41 | + public function workplace_photo() |
|
42 | + { |
|
40 | 43 | return $this->belongsTo(\App\Models\WorkplacePhoto::class); |
41 | 44 | } |
42 | 45 |
@@ -37,15 +37,18 @@ |
||
37 | 37 | */ |
38 | 38 | protected $with = ['review_status']; |
39 | 39 | |
40 | - public function job_application() { |
|
40 | + public function job_application() |
|
41 | + { |
|
41 | 42 | return $this->belongsTo(JobApplication::class); |
42 | 43 | } |
43 | 44 | |
44 | - public function review_status() { |
|
45 | + public function review_status() |
|
46 | + { |
|
45 | 47 | return $this->belongsTo(ReviewStatus::class); |
46 | 48 | } |
47 | 49 | |
48 | - public function getStatusAttribute() { |
|
50 | + public function getStatusAttribute() |
|
51 | + { |
|
49 | 52 | return $this->review_status->translation; |
50 | 53 | } |
51 | 54 | } |
@@ -20,7 +20,8 @@ discard block |
||
20 | 20 | * @property \App\Models\JobApplication $job_application |
21 | 21 | * @property \App\Models\JobPosterQuestion $job_poster_question |
22 | 22 | */ |
23 | -class JobApplicationAnswer extends BaseModel { |
|
23 | +class JobApplicationAnswer extends BaseModel |
|
24 | +{ |
|
24 | 25 | |
25 | 26 | protected $casts = [ |
26 | 27 | 'job_poster_questions_id' => 'int', |
@@ -30,11 +31,13 @@ discard block |
||
30 | 31 | 'answer' |
31 | 32 | ]; |
32 | 33 | |
33 | - public function job_application() { |
|
34 | + public function job_application() |
|
35 | + { |
|
34 | 36 | return $this->belongsTo(\App\Models\JobApplication::class); |
35 | 37 | } |
36 | 38 | |
37 | - public function job_poster_question() { |
|
39 | + public function job_poster_question() |
|
40 | + { |
|
38 | 41 | return $this->belongsTo(\App\Models\JobPosterQuestion::class); |
39 | 42 | } |
40 | 43 |
@@ -25,7 +25,8 @@ discard block |
||
25 | 25 | * @property \App\Models\Lookup\CourseStatus $course_status |
26 | 26 | * @property \App\Models\Applicant $applicant |
27 | 27 | */ |
28 | -class Course extends BaseModel { |
|
28 | +class Course extends BaseModel |
|
29 | +{ |
|
29 | 30 | |
30 | 31 | protected $casts = [ |
31 | 32 | 'name' => 'string', |
@@ -43,11 +44,13 @@ discard block |
||
43 | 44 | 'end_date' |
44 | 45 | ]; |
45 | 46 | |
46 | - public function course_status() { |
|
47 | + public function course_status() |
|
48 | + { |
|
47 | 49 | return $this->belongsTo(\App\Models\Lookup\CourseStatus::class); |
48 | 50 | } |
49 | 51 | |
50 | - public function applicant() { |
|
52 | + public function applicant() |
|
53 | + { |
|
51 | 54 | return $this->belongsTo(\App\Models\Applicant::class); |
52 | 55 | } |
53 | 56 | } |
@@ -9,7 +9,8 @@ |
||
9 | 9 | use Jenssegers\Date\Date; |
10 | 10 | use DateTime; |
11 | 11 | |
12 | -abstract class BaseModel extends Eloquent { |
|
12 | +abstract class BaseModel extends Eloquent |
|
13 | +{ |
|
13 | 14 | //Override date functions to return Jenssegers Data instead of Carbon |
14 | 15 | |
15 | 16 | /** |
@@ -21,7 +21,8 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @property \Illuminate\Database\Eloquent\Collection $references |
23 | 23 | */ |
24 | -class Project extends BaseModel { |
|
24 | +class Project extends BaseModel |
|
25 | +{ |
|
25 | 26 | |
26 | 27 | protected $casts = [ |
27 | 28 | 'name' => 'string', |
@@ -35,11 +36,13 @@ discard block |
||
35 | 36 | 'end_date' |
36 | 37 | ]; |
37 | 38 | |
38 | - public function references() { |
|
39 | + public function references() |
|
40 | + { |
|
39 | 41 | return $this->belongsToMany(\App\Models\Reference::class); |
40 | 42 | } |
41 | 43 | |
42 | - public function applicant() { |
|
44 | + public function applicant() |
|
45 | + { |
|
43 | 46 | return $this->belongsTo(\App\Models\Applicant::class); |
44 | 47 | } |
45 | 48 | } |