@@ -18,7 +18,7 @@ |
||
| 18 | 18 | { |
| 19 | 19 | protected $fillable = []; |
| 20 | 20 | |
| 21 | - public function degrees() { |
|
| 22 | - return $this->hasMany(\App\Models\Degree::class); |
|
| 21 | + public function degrees () { |
|
| 22 | + return $this->hasMany (\App\Models\Degree::class); |
|
| 23 | 23 | } |
| 24 | 24 | } |
@@ -28,8 +28,8 @@ |
||
| 28 | 28 | ]; |
| 29 | 29 | protected $fillable = []; |
| 30 | 30 | |
| 31 | - public function experience_level() { |
|
| 32 | - return $this->belongsTo(\App\Models\Lookup\ExperienceLevel::class); |
|
| 31 | + public function experience_level () { |
|
| 32 | + return $this->belongsTo (\App\Models\Lookup\ExperienceLevel::class); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | } |
@@ -28,18 +28,18 @@ |
||
| 28 | 28 | |
| 29 | 29 | protected $fillable = []; |
| 30 | 30 | |
| 31 | - public function applicant_profile_answers() { |
|
| 32 | - return $this->hasMany(\App\Models\ApplicantProfileAnswer::class); |
|
| 31 | + public function applicant_profile_answers () { |
|
| 32 | + return $this->hasMany (\App\Models\ApplicantProfileAnswer::class); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | // Accessors |
| 36 | 36 | |
| 37 | - public function getQuestionAttribute() { |
|
| 38 | - return Lang::get('common/lookup/applicant_profile_questions')[$this->name]['question']; |
|
| 37 | + public function getQuestionAttribute () { |
|
| 38 | + return Lang::get ('common/lookup/applicant_profile_questions')[$this->name]['question']; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function getDescriptionAttribute() { |
|
| 42 | - return Lang::get('common/lookup/applicant_profile_questions')[$this->name]['description']; |
|
| 41 | + public function getDescriptionAttribute () { |
|
| 42 | + return Lang::get ('common/lookup/applicant_profile_questions')[$this->name]['description']; |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | } |
@@ -53,56 +53,56 @@ |
||
| 53 | 53 | 'linkedin_url' |
| 54 | 54 | ]; |
| 55 | 55 | |
| 56 | - public function user() |
|
| 56 | + public function user () |
|
| 57 | 57 | { |
| 58 | - return $this->belongsTo(\App\Models\User::class); |
|
| 58 | + return $this->belongsTo (\App\Models\User::class); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - public function applicant_profile_answers() |
|
| 61 | + public function applicant_profile_answers () |
|
| 62 | 62 | { |
| 63 | - return $this->hasMany(\App\Models\ApplicantProfileAnswer::class); |
|
| 63 | + return $this->hasMany (\App\Models\ApplicantProfileAnswer::class); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - public function job_applications() |
|
| 66 | + public function job_applications () |
|
| 67 | 67 | { |
| 68 | 68 | if ($this->is_snapshot) { |
| 69 | - return $this->hasMany(\App\Models\JobApplication::class, 'applicant_snapshot_id'); |
|
| 69 | + return $this->hasMany (\App\Models\JobApplication::class, 'applicant_snapshot_id'); |
|
| 70 | 70 | } |
| 71 | - return $this->hasMany(\App\Models\JobApplication::class); |
|
| 71 | + return $this->hasMany (\App\Models\JobApplication::class); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - public function degrees() |
|
| 74 | + public function degrees () |
|
| 75 | 75 | { |
| 76 | - return $this->morphMany(\App\Models\Degree::class, 'degreeable')->orderBy('end_date', 'desc'); |
|
| 76 | + return $this->morphMany (\App\Models\Degree::class, 'degreeable')->orderBy ('end_date', 'desc'); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - public function courses() |
|
| 79 | + public function courses () |
|
| 80 | 80 | { |
| 81 | - return $this->morphMany(\App\Models\Course::class, 'courseable')->orderBy('end_date', 'desc'); |
|
| 81 | + return $this->morphMany (\App\Models\Course::class, 'courseable')->orderBy ('end_date', 'desc'); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - public function work_experiences() |
|
| 84 | + public function work_experiences () |
|
| 85 | 85 | { |
| 86 | - return $this->morphMany(\App\Models\WorkExperience::class, 'experienceable')->orderBy('end_date', 'desc'); |
|
| 86 | + return $this->morphMany (\App\Models\WorkExperience::class, 'experienceable')->orderBy ('end_date', 'desc'); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - public function skill_declarations() |
|
| 89 | + public function skill_declarations () |
|
| 90 | 90 | { |
| 91 | - return $this->morphMany(\App\Models\SkillDeclaration::class, 'skillable'); |
|
| 91 | + return $this->morphMany (\App\Models\SkillDeclaration::class, 'skillable'); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - public function references() |
|
| 94 | + public function references () |
|
| 95 | 95 | { |
| 96 | - return $this->morphMany(\App\Models\Reference::class, 'referenceable'); |
|
| 96 | + return $this->morphMany (\App\Models\Reference::class, 'referenceable'); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - public function work_samples() |
|
| 99 | + public function work_samples () |
|
| 100 | 100 | { |
| 101 | - return $this->morphMany(\App\Models\WorkSample::class, 'work_sampleable'); |
|
| 101 | + return $this->morphMany (\App\Models\WorkSample::class, 'work_sampleable'); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - public function projects() |
|
| 104 | + public function projects () |
|
| 105 | 105 | { |
| 106 | - return $this->morphMany(\App\Models\Project::class, 'projectable'); |
|
| 106 | + return $this->morphMany (\App\Models\Project::class, 'projectable'); |
|
| 107 | 107 | } |
| 108 | 108 | } |
@@ -34,8 +34,8 @@ |
||
| 34 | 34 | ]; |
| 35 | 35 | protected $fillable = []; |
| 36 | 36 | |
| 37 | - public function job_poster() //phpcs:ignore |
|
| 37 | + public function job_poster () //phpcs:ignore |
|
| 38 | 38 | { |
| 39 | - return $this->belongsTo(\App\Models\JobPoster::class); |
|
| 39 | + return $this->belongsTo (\App\Models\JobPoster::class); |
|
| 40 | 40 | } |
| 41 | 41 | } |
@@ -25,13 +25,13 @@ |
||
| 25 | 25 | 'key' |
| 26 | 26 | ]; |
| 27 | 27 | |
| 28 | - public function skills() |
|
| 28 | + public function skills () |
|
| 29 | 29 | { |
| 30 | - return $this->belongsToMany(\App\Models\Skill::class)->withTimestamps(); |
|
| 30 | + return $this->belongsToMany (\App\Models\Skill::class)->withTimestamps (); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - public function job_posters() //phpcs:ignore |
|
| 33 | + public function job_posters () //phpcs:ignore |
|
| 34 | 34 | { |
| 35 | - return $this->belongsToMany(\App\Models\JobPoster::class); |
|
| 35 | + return $this->belongsToMany (\App\Models\JobPoster::class); |
|
| 36 | 36 | } |
| 37 | 37 | } |
@@ -59,8 +59,8 @@ |
||
| 59 | 59 | 'culture_special', |
| 60 | 60 | ]; |
| 61 | 61 | |
| 62 | - public function job_poster() |
|
| 62 | + public function job_poster () |
|
| 63 | 63 | { |
| 64 | - return $this->belongsTo(\App\Models\JobPoster::class); |
|
| 64 | + return $this->belongsTo (\App\Models\JobPoster::class); |
|
| 65 | 65 | } |
| 66 | 66 | } |
@@ -46,8 +46,8 @@ |
||
| 46 | 46 | 'learning_path' |
| 47 | 47 | ]; |
| 48 | 48 | |
| 49 | - public function manager() { |
|
| 50 | - return $this->belongsTo(\App\Models\Manager::class); |
|
| 49 | + public function manager () { |
|
| 50 | + return $this->belongsTo (\App\Models\Manager::class); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | } |
@@ -94,91 +94,91 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | protected $appends = ['meets_essential_criteria']; |
| 96 | 96 | |
| 97 | - protected function createApplicantSnapshot($applicant_id) |
|
| 97 | + protected function createApplicantSnapshot ($applicant_id) |
|
| 98 | 98 | { |
| 99 | - $applicant = Applicant::where('id', $applicant_id)->firstOrFail(); |
|
| 99 | + $applicant = Applicant::where ('id', $applicant_id)->firstOrFail (); |
|
| 100 | 100 | |
| 101 | - $snapshot = $applicant->replicate(); |
|
| 101 | + $snapshot = $applicant->replicate (); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - public function applicant() |
|
| 104 | + public function applicant () |
|
| 105 | 105 | { |
| 106 | - return $this->belongsTo(\App\Models\Applicant::class); |
|
| 106 | + return $this->belongsTo (\App\Models\Applicant::class); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - public function applicant_snapshot() |
|
| 109 | + public function applicant_snapshot () |
|
| 110 | 110 | { |
| 111 | - return $this->belongsTo(\App\Models\Applicant::class, 'applicant_snapshot_id'); |
|
| 111 | + return $this->belongsTo (\App\Models\Applicant::class, 'applicant_snapshot_id'); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - public function application_status() |
|
| 114 | + public function application_status () |
|
| 115 | 115 | { |
| 116 | - return $this->belongsTo(\App\Models\Lookup\ApplicationStatus::class); |
|
| 116 | + return $this->belongsTo (\App\Models\Lookup\ApplicationStatus::class); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - public function citizenship_declaration() |
|
| 119 | + public function citizenship_declaration () |
|
| 120 | 120 | { |
| 121 | - return $this->belongsTo(\App\Models\Lookup\CitizenshipDeclaration::class); |
|
| 121 | + return $this->belongsTo (\App\Models\Lookup\CitizenshipDeclaration::class); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - public function veteran_status() |
|
| 124 | + public function veteran_status () |
|
| 125 | 125 | { |
| 126 | - return $this->belongsTo(\App\Models\Lookup\VeteranStatus::class); |
|
| 126 | + return $this->belongsTo (\App\Models\Lookup\VeteranStatus::class); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - public function preferred_language() |
|
| 129 | + public function preferred_language () |
|
| 130 | 130 | { |
| 131 | - return $this->belongsTo(\App\Models\Lookup\PreferredLanguage::class); |
|
| 131 | + return $this->belongsTo (\App\Models\Lookup\PreferredLanguage::class); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - public function job_poster() |
|
| 134 | + public function job_poster () |
|
| 135 | 135 | { |
| 136 | - return $this->belongsTo(\App\Models\JobPoster::class); |
|
| 136 | + return $this->belongsTo (\App\Models\JobPoster::class); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - public function job_application_answers() |
|
| 139 | + public function job_application_answers () |
|
| 140 | 140 | { |
| 141 | - return $this->hasMany(\App\Models\JobApplicationAnswer::class); |
|
| 141 | + return $this->hasMany (\App\Models\JobApplicationAnswer::class); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - public function skill_declarations() |
|
| 144 | + public function skill_declarations () |
|
| 145 | 145 | { |
| 146 | - return $this->morphMany(\App\Models\SkillDeclaration::class, 'skillable'); |
|
| 146 | + return $this->morphMany (\App\Models\SkillDeclaration::class, 'skillable'); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - public function application_review() |
|
| 149 | + public function application_review () |
|
| 150 | 150 | { |
| 151 | - return $this->hasOne(ApplicationReview::class); |
|
| 151 | + return $this->hasOne (ApplicationReview::class); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - public function degrees() |
|
| 154 | + public function degrees () |
|
| 155 | 155 | { |
| 156 | - return $this->morphMany(\App\Models\Degree::class, 'degreeable')->orderBy('end_date', 'desc'); |
|
| 156 | + return $this->morphMany (\App\Models\Degree::class, 'degreeable')->orderBy ('end_date', 'desc'); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - public function courses() |
|
| 159 | + public function courses () |
|
| 160 | 160 | { |
| 161 | - return $this->morphMany(\App\Models\Course::class, 'courseable')->orderBy('end_date', 'desc'); |
|
| 161 | + return $this->morphMany (\App\Models\Course::class, 'courseable')->orderBy ('end_date', 'desc'); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - public function work_experiences() |
|
| 164 | + public function work_experiences () |
|
| 165 | 165 | { |
| 166 | - return $this->morphMany(\App\Models\WorkExperience::class, 'experienceable')->orderBy('end_date', 'desc'); |
|
| 166 | + return $this->morphMany (\App\Models\WorkExperience::class, 'experienceable')->orderBy ('end_date', 'desc'); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - public function references() |
|
| 169 | + public function references () |
|
| 170 | 170 | { |
| 171 | - return $this->morphMany(\App\Models\Reference::class, 'referenceable'); |
|
| 171 | + return $this->morphMany (\App\Models\Reference::class, 'referenceable'); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - public function projects() |
|
| 174 | + public function projects () |
|
| 175 | 175 | { |
| 176 | - return $this->morphMany(\App\Models\Project::class, 'projectable'); |
|
| 176 | + return $this->morphMany (\App\Models\Project::class, 'projectable'); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - public function work_samples() |
|
| 179 | + public function work_samples () |
|
| 180 | 180 | { |
| 181 | - return $this->morphMany(\App\Models\WorkSample::class, 'work_sampleable'); |
|
| 181 | + return $this->morphMany (\App\Models\WorkSample::class, 'work_sampleable'); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | /** |
@@ -194,43 +194,43 @@ discard block |
||
| 194 | 194 | * |
| 195 | 195 | * @return string $status 'complete', 'incomplete' or 'error' |
| 196 | 196 | */ |
| 197 | - public function getSectionStatus(string $section) |
|
| 197 | + public function getSectionStatus (string $section) |
|
| 198 | 198 | { |
| 199 | 199 | // TODO: determine whether sections are complete or invalid |
| 200 | - $validator = new ApplicationValidator(); |
|
| 200 | + $validator = new ApplicationValidator (); |
|
| 201 | 201 | $status = 'incomplete'; |
| 202 | 202 | switch ($section) { |
| 203 | 203 | case 'basics': |
| 204 | - if ($validator->basicsComplete($this)) { |
|
| 204 | + if ($validator->basicsComplete ($this)) { |
|
| 205 | 205 | $status = 'complete'; |
| 206 | 206 | } |
| 207 | 207 | break; |
| 208 | 208 | case 'experience': |
| 209 | - if ($validator->experienceComplete($this)) { |
|
| 209 | + if ($validator->experienceComplete ($this)) { |
|
| 210 | 210 | $status = 'complete'; |
| 211 | 211 | } |
| 212 | 212 | break; |
| 213 | 213 | case 'essential_skills': |
| 214 | - if ($validator->essentialSkillsComplete($this)) { |
|
| 214 | + if ($validator->essentialSkillsComplete ($this)) { |
|
| 215 | 215 | $status = 'complete'; |
| 216 | 216 | } |
| 217 | 217 | break; |
| 218 | 218 | case 'asset_skills': |
| 219 | - if ($validator->assetSkillsComplete($this)) { |
|
| 219 | + if ($validator->assetSkillsComplete ($this)) { |
|
| 220 | 220 | $status = 'complete'; |
| 221 | 221 | } |
| 222 | 222 | break; |
| 223 | 223 | case 'preview': |
| 224 | - if ($validator->basicsComplete($this) && |
|
| 225 | - $validator->experienceComplete($this) && |
|
| 226 | - $validator->essentialSkillsComplete($this) && |
|
| 227 | - $validator->assetSkillsComplete($this) |
|
| 224 | + if ($validator->basicsComplete ($this) && |
|
| 225 | + $validator->experienceComplete ($this) && |
|
| 226 | + $validator->essentialSkillsComplete ($this) && |
|
| 227 | + $validator->assetSkillsComplete ($this) |
|
| 228 | 228 | ) { |
| 229 | 229 | $status = 'complete'; |
| 230 | 230 | } |
| 231 | 231 | break; |
| 232 | 232 | case 'confirm': |
| 233 | - if ($validator->affirmationComplete($this)) { |
|
| 233 | + if ($validator->affirmationComplete ($this)) { |
|
| 234 | 234 | $status = 'complete'; |
| 235 | 235 | } |
| 236 | 236 | break; |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | * |
| 247 | 247 | * @return boolean |
| 248 | 248 | */ |
| 249 | - public function isDraft(): bool |
|
| 249 | + public function isDraft (): bool |
|
| 250 | 250 | { |
| 251 | 251 | return $this->application_status->name === 'draft'; |
| 252 | 252 | } |
@@ -260,16 +260,16 @@ discard block |
||
| 260 | 260 | * |
| 261 | 261 | * @return boolean |
| 262 | 262 | */ |
| 263 | - public function meetsEssentialCriteria(): bool |
|
| 263 | + public function meetsEssentialCriteria (): bool |
|
| 264 | 264 | { |
| 265 | - $essentialCriteria = $this->job_poster->criteria->filter( |
|
| 265 | + $essentialCriteria = $this->job_poster->criteria->filter ( |
|
| 266 | 266 | function ($value, $key) { |
| 267 | 267 | return $value->criteria_type->name == 'essential'; |
| 268 | 268 | } |
| 269 | 269 | ); |
| 270 | - $source = $this->isDraft() ? $this->applicant : $this; |
|
| 270 | + $source = $this->isDraft () ? $this->applicant : $this; |
|
| 271 | 271 | foreach ($essentialCriteria as $criterion) { |
| 272 | - $skillDeclaration = $source->skill_declarations->where('skill_id', $criterion->skill_id)->first(); |
|
| 272 | + $skillDeclaration = $source->skill_declarations->where ('skill_id', $criterion->skill_id)->first (); |
|
| 273 | 273 | if ($skillDeclaration === null || |
| 274 | 274 | $skillDeclaration->skill_level_id < $criterion->skill_level_id |
| 275 | 275 | ) { |
@@ -285,9 +285,9 @@ discard block |
||
| 285 | 285 | * |
| 286 | 286 | * @return boolean |
| 287 | 287 | */ |
| 288 | - public function getMeetsEssentialCriteriaAttribute(): bool |
|
| 288 | + public function getMeetsEssentialCriteriaAttribute (): bool |
|
| 289 | 289 | { |
| 290 | - return $this->meetsEssentialCriteria(); |
|
| 290 | + return $this->meetsEssentialCriteria (); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
@@ -296,44 +296,44 @@ discard block |
||
| 296 | 296 | * |
| 297 | 297 | * @return void |
| 298 | 298 | */ |
| 299 | - public function saveProfileSnapshot(): void |
|
| 299 | + public function saveProfileSnapshot (): void |
|
| 300 | 300 | { |
| 301 | - $applicant = $this->applicant->fresh(); |
|
| 301 | + $applicant = $this->applicant->fresh (); |
|
| 302 | 302 | |
| 303 | 303 | // Delete previous snapshot. |
| 304 | - $this->degrees()->delete(); |
|
| 305 | - $this->courses()->delete(); |
|
| 306 | - $this->work_experiences()->delete(); |
|
| 307 | - $this->projects()->delete(); |
|
| 308 | - $this->references()->delete(); |
|
| 309 | - $this->work_samples()->delete(); |
|
| 310 | - $this->skill_declarations()->delete(); |
|
| 311 | - |
|
| 312 | - $this->degrees()->saveMany($applicant->degrees->map->replicate()); |
|
| 313 | - $this->courses()->saveMany($applicant->courses->map->replicate()); |
|
| 314 | - $this->work_experiences()->saveMany($applicant->work_experiences->map->replicate()); |
|
| 304 | + $this->degrees ()->delete (); |
|
| 305 | + $this->courses ()->delete (); |
|
| 306 | + $this->work_experiences ()->delete (); |
|
| 307 | + $this->projects ()->delete (); |
|
| 308 | + $this->references ()->delete (); |
|
| 309 | + $this->work_samples ()->delete (); |
|
| 310 | + $this->skill_declarations ()->delete (); |
|
| 311 | + |
|
| 312 | + $this->degrees ()->saveMany ($applicant->degrees->map->replicate ()); |
|
| 313 | + $this->courses ()->saveMany ($applicant->courses->map->replicate ()); |
|
| 314 | + $this->work_experiences ()->saveMany ($applicant->work_experiences->map->replicate ()); |
|
| 315 | 315 | |
| 316 | 316 | $copyWithHistory = function ($model) { |
| 317 | 317 | return [ |
| 318 | 318 | 'old' => $model, |
| 319 | - 'new' => $model->replicate() |
|
| 319 | + 'new' => $model->replicate () |
|
| 320 | 320 | ]; |
| 321 | 321 | }; |
| 322 | 322 | |
| 323 | 323 | |
| 324 | - $projectMap = $applicant->projects->map($copyWithHistory); |
|
| 325 | - $referenceMap = $applicant->references->map($copyWithHistory); |
|
| 326 | - $workSampleMap = $applicant->work_samples->map($copyWithHistory); |
|
| 327 | - $skillDeclarationMap = $applicant->skill_declarations->map($copyWithHistory); |
|
| 324 | + $projectMap = $applicant->projects->map ($copyWithHistory); |
|
| 325 | + $referenceMap = $applicant->references->map ($copyWithHistory); |
|
| 326 | + $workSampleMap = $applicant->work_samples->map ($copyWithHistory); |
|
| 327 | + $skillDeclarationMap = $applicant->skill_declarations->map ($copyWithHistory); |
|
| 328 | 328 | |
| 329 | 329 | // First link new projects, references, work samples and skill declarations to this application. |
| 330 | - $this->projects()->saveMany($projectMap->pluck('new')); |
|
| 331 | - $this->references()->saveMany($referenceMap->pluck('new')); |
|
| 332 | - $this->work_samples()->saveMany($workSampleMap->pluck('new')); |
|
| 333 | - $this->skill_declarations()->saveMany($skillDeclarationMap->pluck('new')); |
|
| 330 | + $this->projects ()->saveMany ($projectMap->pluck ('new')); |
|
| 331 | + $this->references ()->saveMany ($referenceMap->pluck ('new')); |
|
| 332 | + $this->work_samples ()->saveMany ($workSampleMap->pluck ('new')); |
|
| 333 | + $this->skill_declarations ()->saveMany ($skillDeclarationMap->pluck ('new')); |
|
| 334 | 334 | |
| 335 | 335 | $findNewFromOld = function ($mapping, $old) { |
| 336 | - $matchingItem = $mapping->first(function ($value) use ($old) { |
|
| 336 | + $matchingItem = $mapping->first (function ($value) use ($old) { |
|
| 337 | 337 | return $value['old']->id === $old->id; |
| 338 | 338 | }); |
| 339 | 339 | return $matchingItem['new']; |
@@ -341,35 +341,35 @@ discard block |
||
| 341 | 341 | |
| 342 | 342 | // Replicate copies shallow attributes, but not relationships. We have to copy those ourselves. |
| 343 | 343 | $findNewReferenceFromOld = function ($old) use ($findNewFromOld, $referenceMap) { |
| 344 | - return $findNewFromOld($referenceMap, $old); |
|
| 344 | + return $findNewFromOld ($referenceMap, $old); |
|
| 345 | 345 | }; |
| 346 | 346 | |
| 347 | 347 | $findNewSkillDeclarationFromOld = function ($old) use ($findNewFromOld, $skillDeclarationMap) { |
| 348 | - return $findNewFromOld($skillDeclarationMap, $old); |
|
| 348 | + return $findNewFromOld ($skillDeclarationMap, $old); |
|
| 349 | 349 | }; |
| 350 | 350 | |
| 351 | 351 | // Link projects and references. |
| 352 | 352 | foreach ($projectMap as $item) { |
| 353 | 353 | $old = $item['old']; |
| 354 | 354 | $newProj = $item['new']; |
| 355 | - $newReferences = $old->references->map($findNewReferenceFromOld); |
|
| 356 | - $newProj->references()->sync($newReferences); |
|
| 355 | + $newReferences = $old->references->map ($findNewReferenceFromOld); |
|
| 356 | + $newProj->references ()->sync ($newReferences); |
|
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | // Link references and skills. |
| 360 | 360 | foreach ($referenceMap as $item) { |
| 361 | 361 | $old = $item['old']; |
| 362 | 362 | $newRef = $item['new']; |
| 363 | - $newSkillDecs = $old->skill_declarations->map($findNewSkillDeclarationFromOld); |
|
| 364 | - $newRef->skill_declarations()->sync($newSkillDecs); |
|
| 363 | + $newSkillDecs = $old->skill_declarations->map ($findNewSkillDeclarationFromOld); |
|
| 364 | + $newRef->skill_declarations ()->sync ($newSkillDecs); |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | // Link work samples and skills. |
| 368 | 368 | foreach ($workSampleMap as $item) { |
| 369 | 369 | $old = $item['old']; |
| 370 | 370 | $newSample = $item['new']; |
| 371 | - $newSkillDecs = $old->skill_declarations->map($findNewSkillDeclarationFromOld); |
|
| 372 | - $newSample->skill_declarations()->sync($newSkillDecs); |
|
| 371 | + $newSkillDecs = $old->skill_declarations->map ($findNewSkillDeclarationFromOld); |
|
| 372 | + $newSample->skill_declarations ()->sync ($newSkillDecs); |
|
| 373 | 373 | } |
| 374 | 374 | } |
| 375 | 375 | } |