@@ -32,15 +32,15 @@ |
||
| 32 | 32 | * @param \Symfony\Component\HttpFoundation\Response $response Outgoing response. |
| 33 | 33 | * @return \Symfony\Component\HttpFoundation\Response |
| 34 | 34 | */ |
| 35 | - protected function addCookieToResponse($request, $response) |
|
| 35 | + protected function addCookieToResponse ($request, $response) |
|
| 36 | 36 | { |
| 37 | 37 | if ($this->addHttpCookie) { |
| 38 | - $config = config('session'); |
|
| 39 | - $response->headers->setCookie( |
|
| 40 | - new Cookie( |
|
| 38 | + $config = config ('session'); |
|
| 39 | + $response->headers->setCookie ( |
|
| 40 | + new Cookie ( |
|
| 41 | 41 | 'XSRF-TOKEN', |
| 42 | - $request->session()->token(), |
|
| 43 | - $this->availableAt(60 * $config['lifetime']), |
|
| 42 | + $request->session ()->token (), |
|
| 43 | + $this->availableAt (60 * $config['lifetime']), |
|
| 44 | 44 | $config['path'], |
| 45 | 45 | $config['domain'], |
| 46 | 46 | $config['secure'], |
@@ -87,62 +87,62 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | protected $appends = ['meets_essential_criteria']; |
| 89 | 89 | |
| 90 | - protected function createApplicantSnapshot($applicant_id) |
|
| 90 | + protected function createApplicantSnapshot ($applicant_id) |
|
| 91 | 91 | { |
| 92 | - $applicant = Applicant::where('id', $applicant_id)->firstOrFail(); |
|
| 92 | + $applicant = Applicant::where ('id', $applicant_id)->firstOrFail (); |
|
| 93 | 93 | |
| 94 | - $snapshot = $applicant->replicate(); |
|
| 94 | + $snapshot = $applicant->replicate (); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - public function applicant() |
|
| 97 | + public function applicant () |
|
| 98 | 98 | { |
| 99 | - return $this->belongsTo(\App\Models\Applicant::class); |
|
| 99 | + return $this->belongsTo (\App\Models\Applicant::class); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - public function applicant_snapshot() |
|
| 102 | + public function applicant_snapshot () |
|
| 103 | 103 | { |
| 104 | - return $this->belongsTo(\App\Models\Applicant::class, 'applicant_snapshot_id'); |
|
| 104 | + return $this->belongsTo (\App\Models\Applicant::class, 'applicant_snapshot_id'); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - public function application_status() |
|
| 107 | + public function application_status () |
|
| 108 | 108 | { |
| 109 | - return $this->belongsTo(\App\Models\Lookup\ApplicationStatus::class); |
|
| 109 | + return $this->belongsTo (\App\Models\Lookup\ApplicationStatus::class); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - public function citizenship_declaration() |
|
| 112 | + public function citizenship_declaration () |
|
| 113 | 113 | { |
| 114 | - return $this->belongsTo(\App\Models\Lookup\CitizenshipDeclaration::class); |
|
| 114 | + return $this->belongsTo (\App\Models\Lookup\CitizenshipDeclaration::class); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - public function veteran_status() |
|
| 117 | + public function veteran_status () |
|
| 118 | 118 | { |
| 119 | - return $this->belongsTo(\App\Models\Lookup\VeteranStatus::class); |
|
| 119 | + return $this->belongsTo (\App\Models\Lookup\VeteranStatus::class); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - public function preferred_language() |
|
| 122 | + public function preferred_language () |
|
| 123 | 123 | { |
| 124 | - return $this->belongsTo(\App\Models\Lookup\PreferredLanguage::class); |
|
| 124 | + return $this->belongsTo (\App\Models\Lookup\PreferredLanguage::class); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - public function job_poster() |
|
| 127 | + public function job_poster () |
|
| 128 | 128 | { |
| 129 | - return $this->belongsTo(\App\Models\JobPoster::class); |
|
| 129 | + return $this->belongsTo (\App\Models\JobPoster::class); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - public function job_application_answers() |
|
| 132 | + public function job_application_answers () |
|
| 133 | 133 | { |
| 134 | - return $this->hasMany(\App\Models\JobApplicationAnswer::class); |
|
| 134 | + return $this->hasMany (\App\Models\JobApplicationAnswer::class); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - public function skill_declarations() |
|
| 137 | + public function skill_declarations () |
|
| 138 | 138 | { |
| 139 | - return $this->applicant->skill_declarations() |
|
| 140 | - ->whereIn('skill_id', $this->job_poster->criteria->pluck('skill_id')); |
|
| 139 | + return $this->applicant->skill_declarations () |
|
| 140 | + ->whereIn ('skill_id', $this->job_poster->criteria->pluck ('skill_id')); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - public function application_review() |
|
| 143 | + public function application_review () |
|
| 144 | 144 | { |
| 145 | - return $this->hasOne(ApplicationReview::class); |
|
| 145 | + return $this->hasOne (ApplicationReview::class); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
@@ -158,42 +158,42 @@ discard block |
||
| 158 | 158 | * |
| 159 | 159 | * @return string $status 'complete', 'incomplete' or 'error' |
| 160 | 160 | */ |
| 161 | - public function getSectionStatus(string $section) |
|
| 161 | + public function getSectionStatus (string $section) |
|
| 162 | 162 | { |
| 163 | 163 | // TODO: determine whether sections are complete or invalid |
| 164 | - $validator = new ApplicationValidator(); |
|
| 164 | + $validator = new ApplicationValidator (); |
|
| 165 | 165 | $status = 'incomplete'; |
| 166 | 166 | switch ($section) { |
| 167 | 167 | case 'basics': |
| 168 | - if ($validator->basicsComplete($this)) { |
|
| 168 | + if ($validator->basicsComplete ($this)) { |
|
| 169 | 169 | $status = 'complete'; |
| 170 | 170 | } |
| 171 | 171 | break; |
| 172 | 172 | case 'experience': |
| 173 | - if ($validator->experienceComplete($this)) { |
|
| 173 | + if ($validator->experienceComplete ($this)) { |
|
| 174 | 174 | $status = 'complete'; |
| 175 | 175 | } |
| 176 | 176 | break; |
| 177 | 177 | case 'essential_skills': |
| 178 | - if ($validator->essentialSkillsComplete($this)) { |
|
| 178 | + if ($validator->essentialSkillsComplete ($this)) { |
|
| 179 | 179 | $status = 'complete'; |
| 180 | 180 | } |
| 181 | 181 | break; |
| 182 | 182 | case 'asset_skills': |
| 183 | - if ($validator->assetSkillsComplete($this)) { |
|
| 183 | + if ($validator->assetSkillsComplete ($this)) { |
|
| 184 | 184 | $status = 'complete'; |
| 185 | 185 | } |
| 186 | 186 | break; |
| 187 | 187 | case 'preview': |
| 188 | - if ($validator->basicsComplete($this) && |
|
| 189 | - $validator->experienceComplete($this) && |
|
| 190 | - $validator->essentialSkillsComplete($this) && |
|
| 191 | - $validator->assetSkillsComplete($this)) { |
|
| 188 | + if ($validator->basicsComplete ($this) && |
|
| 189 | + $validator->experienceComplete ($this) && |
|
| 190 | + $validator->essentialSkillsComplete ($this) && |
|
| 191 | + $validator->assetSkillsComplete ($this)) { |
|
| 192 | 192 | $status = 'complete'; |
| 193 | 193 | } |
| 194 | 194 | break; |
| 195 | 195 | case 'confirm': |
| 196 | - if ($validator->affirmationComplete($this)) { |
|
| 196 | + if ($validator->affirmationComplete ($this)) { |
|
| 197 | 197 | $status = 'complete'; |
| 198 | 198 | } |
| 199 | 199 | break; |
@@ -211,15 +211,15 @@ discard block |
||
| 211 | 211 | * |
| 212 | 212 | * @return boolean |
| 213 | 213 | */ |
| 214 | - public function meetsEssentialCriteria(): bool |
|
| 214 | + public function meetsEssentialCriteria (): bool |
|
| 215 | 215 | { |
| 216 | - $essentialCriteria = $this->job_poster->criteria->filter( |
|
| 217 | - function($value, $key){ |
|
| 216 | + $essentialCriteria = $this->job_poster->criteria->filter ( |
|
| 217 | + function ($value, $key) { |
|
| 218 | 218 | return $value->criteria_type->name == 'essential'; |
| 219 | 219 | } |
| 220 | 220 | ); |
| 221 | 221 | foreach ($essentialCriteria as $criterion) { |
| 222 | - $skillDeclaration = $this->skill_declarations->where('skill_id', $criterion->skill_id)->first(); |
|
| 222 | + $skillDeclaration = $this->skill_declarations->where ('skill_id', $criterion->skill_id)->first (); |
|
| 223 | 223 | if ($skillDeclaration === null || |
| 224 | 224 | $skillDeclaration->skill_level_id < $criterion->skill_level_id) { |
| 225 | 225 | return false; |
@@ -234,8 +234,8 @@ discard block |
||
| 234 | 234 | * |
| 235 | 235 | * @return boolean |
| 236 | 236 | */ |
| 237 | - public function getMeetsEssentialCriteriaAttribute():bool |
|
| 237 | + public function getMeetsEssentialCriteriaAttribute ():bool |
|
| 238 | 238 | { |
| 239 | - return $this->meetsEssentialCriteria(); |
|
| 239 | + return $this->meetsEssentialCriteria (); |
|
| 240 | 240 | } |
| 241 | 241 | } |
@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | * |
| 25 | 25 | * @return void |
| 26 | 26 | */ |
| 27 | - public function boot() |
|
| 27 | + public function boot () |
|
| 28 | 28 | { |
| 29 | 29 | |
| 30 | - parent::boot(); |
|
| 30 | + parent::boot (); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -35,11 +35,11 @@ discard block |
||
| 35 | 35 | * |
| 36 | 36 | * @return void |
| 37 | 37 | */ |
| 38 | - public function map() |
|
| 38 | + public function map () |
|
| 39 | 39 | { |
| 40 | - $this->mapApiRoutes(); |
|
| 40 | + $this->mapApiRoutes (); |
|
| 41 | 41 | |
| 42 | - $this->mapWebRoutes(); |
|
| 42 | + $this->mapWebRoutes (); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -49,11 +49,11 @@ discard block |
||
| 49 | 49 | * |
| 50 | 50 | * @return void |
| 51 | 51 | */ |
| 52 | - protected function mapWebRoutes() |
|
| 52 | + protected function mapWebRoutes () |
|
| 53 | 53 | { |
| 54 | - Route::middleware('web') |
|
| 55 | - ->namespace($this->namespace) |
|
| 56 | - ->group(base_path('routes/web.php')); |
|
| 54 | + Route::middleware ('web') |
|
| 55 | + ->namespace ($this->namespace) |
|
| 56 | + ->group (base_path ('routes/web.php')); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -63,11 +63,11 @@ discard block |
||
| 63 | 63 | * |
| 64 | 64 | * @return void |
| 65 | 65 | */ |
| 66 | - protected function mapApiRoutes() |
|
| 66 | + protected function mapApiRoutes () |
|
| 67 | 67 | { |
| 68 | - Route::prefix('api') |
|
| 69 | - ->middleware('api') |
|
| 70 | - ->namespace($this->namespace) |
|
| 71 | - ->group(base_path('routes/api.php')); |
|
| 68 | + Route::prefix ('api') |
|
| 69 | + ->middleware ('api') |
|
| 70 | + ->namespace ($this->namespace) |
|
| 71 | + ->group (base_path ('routes/api.php')); |
|
| 72 | 72 | } |
| 73 | 73 | } |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | * |
| 16 | 16 | * @return void |
| 17 | 17 | */ |
| 18 | - public function __construct() |
|
| 18 | + public function __construct () |
|
| 19 | 19 | { |
| 20 | 20 | } |
| 21 | 21 | |
@@ -25,30 +25,30 @@ discard block |
||
| 25 | 25 | * @param ApplicationSaved $event |
| 26 | 26 | * @return void |
| 27 | 27 | */ |
| 28 | - public function handle(ApplicationSaved $event) |
|
| 28 | + public function handle (ApplicationSaved $event) |
|
| 29 | 29 | { |
| 30 | 30 | $application = $event->application; |
| 31 | 31 | |
| 32 | - if (Auth::check()) { |
|
| 33 | - $user = Auth::user(); |
|
| 34 | - $userText = '{id=' . $user->id . ', email=' . $user->email . '}'; |
|
| 32 | + if (Auth::check ()) { |
|
| 33 | + $user = Auth::user (); |
|
| 34 | + $userText = '{id='.$user->id.', email='.$user->email.'}'; |
|
| 35 | 35 | } else { |
| 36 | 36 | $userText = '{null}'; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | // Log when application is first created |
| 40 | 40 | if ($application->wasRecentlyCreated) { |
| 41 | - $applicationText = '{id=' . $application->id . ', status=' . $application->application_status->name . '}'; |
|
| 41 | + $applicationText = '{id='.$application->id.', status='.$application->application_status->name.'}'; |
|
| 42 | 42 | |
| 43 | - Log::notice('Application created: application ' . $applicationText . ' has been created by user ' . $userText); |
|
| 43 | + Log::notice ('Application created: application '.$applicationText.' has been created by user '.$userText); |
|
| 44 | 44 | } |
| 45 | 45 | // Log if application status has been changed |
| 46 | - elseif ($application->application_status_id != $application->getOriginal('application_status_id')) { |
|
| 47 | - $freshApplication = $application->fresh(); |
|
| 48 | - $applicationText = '{id=' . $freshApplication->id . '}'; |
|
| 49 | - $statusText = '{' . $freshApplication->application_status->name . '}'; |
|
| 46 | + elseif ($application->application_status_id != $application->getOriginal ('application_status_id')) { |
|
| 47 | + $freshApplication = $application->fresh (); |
|
| 48 | + $applicationText = '{id='.$freshApplication->id.'}'; |
|
| 49 | + $statusText = '{'.$freshApplication->application_status->name.'}'; |
|
| 50 | 50 | |
| 51 | - Log::notice('Application status changed: application ' . $applicationText . ' has been changed to ' . $statusText . ' by user ' . $userText); |
|
| 51 | + Log::notice ('Application status changed: application '.$applicationText.' has been changed to '.$statusText.' by user '.$userText); |
|
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | * |
| 15 | 15 | * @return void |
| 16 | 16 | */ |
| 17 | - public function __construct() |
|
| 17 | + public function __construct () |
|
| 18 | 18 | { |
| 19 | 19 | } |
| 20 | 20 | |
@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | * @param UserUpdated $event |
| 25 | 25 | * @return void |
| 26 | 26 | */ |
| 27 | - public function handle(UserUpdated $event) |
|
| 27 | + public function handle (UserUpdated $event) |
|
| 28 | 28 | { |
| 29 | - Log::notice('User updated: ' . $event->user); |
|
| 29 | + Log::notice ('User updated: '.$event->user); |
|
| 30 | 30 | } |
| 31 | 31 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | * |
| 15 | 15 | * @return void |
| 16 | 16 | */ |
| 17 | - public function __construct() |
|
| 17 | + public function __construct () |
|
| 18 | 18 | { |
| 19 | 19 | } |
| 20 | 20 | |
@@ -25,9 +25,9 @@ discard block |
||
| 25 | 25 | * @param Login $event |
| 26 | 26 | * @return void |
| 27 | 27 | */ |
| 28 | - public function handle(Login $event) |
|
| 28 | + public function handle (Login $event) |
|
| 29 | 29 | { |
| 30 | 30 | $user = $event->user; |
| 31 | - Log::notice('Login by user {id=' . $user->id . ', email=' . $user->email . ', role=' . $user->user_role->name . '}'); |
|
| 31 | + Log::notice ('Login by user {id='.$user->id.', email='.$user->email.', role='.$user->user_role->name.'}'); |
|
| 32 | 32 | } |
| 33 | 33 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | * |
| 15 | 15 | * @return void |
| 16 | 16 | */ |
| 17 | - public function __construct() |
|
| 17 | + public function __construct () |
|
| 18 | 18 | { |
| 19 | 19 | } |
| 20 | 20 | |
@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | * @param UserCreated $event |
| 25 | 25 | * @return void |
| 26 | 26 | */ |
| 27 | - public function handle(UserCreated $event) |
|
| 27 | + public function handle (UserCreated $event) |
|
| 28 | 28 | { |
| 29 | - Log::notice('User created: ' . $event->user); |
|
| 29 | + Log::notice ('User created: '.$event->user); |
|
| 30 | 30 | } |
| 31 | 31 | } |
@@ -15,27 +15,27 @@ |
||
| 15 | 15 | protected $applicant; |
| 16 | 16 | protected $course_status_id; |
| 17 | 17 | |
| 18 | - public function __construct(Applicant $applicant) |
|
| 18 | + public function __construct (Applicant $applicant) |
|
| 19 | 19 | { |
| 20 | 20 | $this->applicant = $applicant; |
| 21 | - $this->course_status_ids = CourseStatus::all()->pluck('id'); |
|
| 21 | + $this->course_status_ids = CourseStatus::all ()->pluck ('id'); |
|
| 22 | 22 | } |
| 23 | - public function validate(CourseValidator $courseValidator) |
|
| 23 | + public function validate (CourseValidator $courseValidator) |
|
| 24 | 24 | { |
| 25 | - $uniqueSkillRule = new UniqueApplicantSkillRule($this->applicant, $courseValidator->id); |
|
| 25 | + $uniqueSkillRule = new UniqueApplicantSkillRule ($this->applicant, $courseValidator->id); |
|
| 26 | 26 | // This array is reset every time because applicants table can change frequently |
| 27 | - $applicant_ids = Applicant::all()->pluck('id'); |
|
| 27 | + $applicant_ids = Applicant::all ()->pluck ('id'); |
|
| 28 | 28 | // Validate basic data is filled in |
| 29 | - Validator::make($courseValidator->getAttributes(), [ |
|
| 29 | + Validator::make ($courseValidator->getAttributes (), [ |
|
| 30 | 30 | 'applicant_id' => [ |
| 31 | 31 | 'required', |
| 32 | - Rule::in($applicant_ids->toArray()), |
|
| 32 | + Rule::in ($applicant_ids->toArray ()), |
|
| 33 | 33 | ], |
| 34 | 34 | 'course_status_id' => [ |
| 35 | 35 | 'required', |
| 36 | - Rule::in($this->course_status_ids->toArray()), |
|
| 36 | + Rule::in ($this->course_status_ids->toArray ()), |
|
| 37 | 37 | ] |
| 38 | 38 | |
| 39 | - ])->validate(); |
|
| 39 | + ])->validate (); |
|
| 40 | 40 | } |
| 41 | 41 | } |
@@ -14,27 +14,27 @@ |
||
| 14 | 14 | protected $applicant; |
| 15 | 15 | protected $degree_type_id; |
| 16 | 16 | |
| 17 | - public function __construct(Applicant $applicant) |
|
| 17 | + public function __construct (Applicant $applicant) |
|
| 18 | 18 | { |
| 19 | 19 | $this->applicant = $applicant; |
| 20 | - $this->degree_type_id = DegreeType::all()->pluck('id'); |
|
| 20 | + $this->degree_type_id = DegreeType::all ()->pluck ('id'); |
|
| 21 | 21 | } |
| 22 | - public function validate(DegreeValidator $degreeValidator) |
|
| 22 | + public function validate (DegreeValidator $degreeValidator) |
|
| 23 | 23 | { |
| 24 | - $uniqueSkillRule = new UniqueApplicantSkillRule($this->applicant, $degreeValidator->id); |
|
| 24 | + $uniqueSkillRule = new UniqueApplicantSkillRule ($this->applicant, $degreeValidator->id); |
|
| 25 | 25 | // This array is reset every time because applicants table can change frequently |
| 26 | - $applicant_ids = Applicant::all()->pluck('id'); |
|
| 26 | + $applicant_ids = Applicant::all ()->pluck ('id'); |
|
| 27 | 27 | // Validate basic data is filled in |
| 28 | - Validator::make($degreeValidator->getAttributes(), [ |
|
| 28 | + Validator::make ($degreeValidator->getAttributes (), [ |
|
| 29 | 29 | 'applicant_id' => [ |
| 30 | 30 | 'required', |
| 31 | - Rule::in($applicant_ids->toArray()), |
|
| 31 | + Rule::in ($applicant_ids->toArray ()), |
|
| 32 | 32 | ], |
| 33 | 33 | 'degree_type_id' => [ |
| 34 | 34 | 'required', |
| 35 | - Rule::in($this->degree_type_id->toArray()), |
|
| 35 | + Rule::in ($this->degree_type_id->toArray ()), |
|
| 36 | 36 | ] |
| 37 | 37 | |
| 38 | - ])->validate(); |
|
| 38 | + ])->validate (); |
|
| 39 | 39 | } |
| 40 | 40 | } |