| Total Complexity | 71 |
| Total Lines | 738 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
Complex classes like ApplicationByJobController often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use ApplicationByJobController, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 28 | class ApplicationByJobController extends Controller |
||
| 29 | { |
||
| 30 | /** |
||
| 31 | * Display a listing of the resource. |
||
| 32 | * |
||
| 33 | * @return \Illuminate\Http\Response |
||
| 34 | */ |
||
| 35 | public function index() |
||
| 37 | // |
||
| 38 | } |
||
| 39 | |||
| 40 | protected function getApplicationFromJob(JobPoster $jobPoster) { |
||
| 41 | $application = JobApplication::where('applicant_id', Auth::user()->applicant->id) |
||
| 42 | ->where('job_poster_id', $jobPoster->id)->first(); |
||
| 43 | if ($application == null) { |
||
| 44 | $application = new JobApplication(); |
||
| 45 | $application->job_poster_id = $jobPoster->id; |
||
| 46 | $application->applicant_id = Auth::user()->applicant->id; |
||
| 47 | $application->application_status_id = ApplicationStatus::where('name', 'draft')->firstOrFail()->id; |
||
| 48 | $application->save(); |
||
| 49 | } |
||
| 50 | return $application; |
||
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * Show the form for editing Application basics for the specified job. |
||
| 55 | * |
||
| 56 | * @param \App\Models\JobPoster $jobPoster |
||
| 57 | * @return \Illuminate\Http\Response |
||
| 58 | */ |
||
| 59 | public function edit_basics(JobPoster $jobPoster) |
||
| 60 | { |
||
| 61 | |||
| 62 | $applicant = Auth::user()->applicant; |
||
| 63 | |||
| 64 | $application = $this->getApplicationFromJob($jobPoster); |
||
| 65 | |||
| 66 | //Ensure user has permissions to view and update application |
||
| 67 | $this->authorize('view', $application); |
||
| 68 | $this->authorize('update', $application); |
||
| 69 | |||
| 70 | return view('applicant/application_post_01', [ |
||
|
1 ignored issue
–
show
|
|||
| 71 | |||
| 72 | /* Application Template Data */ |
||
| 73 | "application_step" => 1, |
||
| 74 | "application_template" => Lang::get("applicant/application_template"), |
||
| 75 | "language_options" => PreferredLanguage::all(), |
||
| 76 | "citizenship_options" => CitizenshipDeclaration::all(), |
||
| 77 | "veteran_options" => VeteranStatus::all(), |
||
| 78 | "preferred_language_template" => Lang::get('common/preferred_language'), |
||
| 79 | "citizenship_declaration_template" => Lang::get('common/citizenship_declaration'), |
||
| 80 | "veteran_status_template" => Lang::get('common/veteran_status'), |
||
| 81 | |||
| 82 | /* Job Data */ |
||
| 83 | "job" => $jobPoster, |
||
| 84 | |||
| 85 | /* Applicant Data */ |
||
| 86 | "applicant" => $applicant, |
||
| 87 | "job_application" => $application, |
||
| 88 | |||
| 89 | /* Submission */ |
||
| 90 | "form_submit_action" => route('job.application.update.1', $jobPoster) |
||
| 91 | |||
| 92 | ]); |
||
| 93 | |||
| 94 | } |
||
| 95 | |||
| 96 | /** |
||
| 97 | * Show the form for editing Application Experience for the specified job. |
||
| 98 | * |
||
| 99 | * @param \App\Models\JobPoster $jobPoster |
||
| 100 | * @return \Illuminate\Http\Response |
||
| 101 | */ |
||
| 102 | public function edit_experience(JobPoster $jobPoster) |
||
| 103 | { |
||
| 104 | |||
| 105 | $applicant = Auth::user()->applicant; |
||
| 106 | |||
| 107 | $application = $this->getApplicationFromJob($jobPoster); |
||
| 108 | |||
| 109 | //Ensure user has permissions to view and update application |
||
| 110 | $this->authorize('view', $application); |
||
| 111 | $this->authorize('update', $application); |
||
| 112 | |||
| 113 | return view('applicant/application_post_02', [ |
||
|
1 ignored issue
–
show
|
|||
| 114 | |||
| 115 | /* Application Template Data */ |
||
| 116 | "application_step" => 2, |
||
| 117 | "application_template" => Lang::get("applicant/application_template"), |
||
| 118 | |||
| 119 | /* Job Data */ |
||
| 120 | "job" => $jobPoster, |
||
| 121 | |||
| 122 | /* Applicant Data */ |
||
| 123 | "applicant" => $applicant, |
||
| 124 | "job_application" => $application, |
||
| 125 | |||
| 126 | /* Submission */ |
||
| 127 | "form_submit_action" => route('job.application.update.2', $jobPoster) |
||
| 128 | |||
| 129 | ]); |
||
| 130 | |||
| 131 | } |
||
| 132 | |||
| 133 | /** |
||
| 134 | * Show the form for editing Application Essential Skills for the specified job. |
||
| 135 | * |
||
| 136 | * @param \App\Models\JobPoster $jobPoster |
||
| 137 | * @return \Illuminate\Http\Response |
||
| 138 | */ |
||
| 139 | public function edit_essential_skills(JobPoster $jobPoster) |
||
| 140 | { |
||
| 141 | |||
| 142 | $applicant = Auth::user()->applicant; |
||
| 143 | |||
| 144 | $application = $this->getApplicationFromJob($jobPoster); |
||
| 145 | |||
| 146 | //Ensure user has permissions to view and update application |
||
| 147 | $this->authorize('view', $application); |
||
| 148 | $this->authorize('update', $application); |
||
| 149 | |||
| 150 | $criteria = [ |
||
| 151 | 'essential' => $jobPoster->criteria->filter(function($value, $key) { |
||
| 152 | return $value->criteria_type->name == 'essential'; |
||
| 153 | }), |
||
| 154 | 'asset' => $jobPoster->criteria->filter(function($value, $key) { |
||
| 155 | return $value->criteria_type->name == 'asset'; |
||
| 156 | }), |
||
| 157 | ]; |
||
| 158 | |||
| 159 | return view('applicant/application_post_03', [ |
||
|
1 ignored issue
–
show
|
|||
| 160 | |||
| 161 | /* Application Template Data */ |
||
| 162 | "application_step" => 3, |
||
| 163 | "application_template" => Lang::get("applicant/application_template"), |
||
| 164 | |||
| 165 | /* Job Data */ |
||
| 166 | "job" => $jobPoster, |
||
| 167 | |||
| 168 | /* Skills Data */ |
||
| 169 | "skills" => Skill::all(), |
||
| 170 | "skill_template" => Lang::get("common/skills"), |
||
| 171 | "criteria" => $criteria, |
||
| 172 | |||
| 173 | /* Applicant Data */ |
||
| 174 | "applicant" => $applicant, |
||
| 175 | "job_application" => $application, |
||
| 176 | |||
| 177 | /* Submission */ |
||
| 178 | "form_submit_action" => route('job.application.update.3', $jobPoster) |
||
| 179 | |||
| 180 | ]); |
||
| 181 | |||
| 182 | } |
||
| 183 | |||
| 184 | /** |
||
| 185 | * Show the form for editing Application Asset Skills for the specified job. |
||
| 186 | * |
||
| 187 | * @param \App\Models\JobPoster $jobPoster |
||
| 188 | * @return \Illuminate\Http\Response |
||
| 189 | */ |
||
| 190 | public function edit_asset_skills(JobPoster $jobPoster) |
||
| 230 | |||
| 231 | ]); |
||
| 232 | } |
||
| 233 | |||
| 234 | /** |
||
| 235 | * Show the Application Preview for the application for the specified job. |
||
| 236 | * |
||
| 237 | * @param \App\Models\JobPoster $jobPoster |
||
| 238 | * @return \Illuminate\Http\Response |
||
| 239 | */ |
||
| 240 | public function preview(JobPoster $jobPoster) { |
||
| 241 | |||
| 242 | $applicant = Auth::user()->applicant; |
||
| 243 | |||
| 244 | $application = $this->getApplicationFromJob($jobPoster); |
||
| 245 | |||
| 246 | //TODO: Right now preview can't have the update gate, because we use the |
||
| 247 | // same view for viewing even after its been submitted. These should |
||
| 248 | // be seperate views, and then Preview can require the update permission. |
||
| 249 | //Ensure user has permissions to view and update application |
||
| 250 | $this->authorize('view', $application); |
||
| 251 | //$this->authorize('update', $application); |
||
| 252 | |||
| 253 | $criteria = [ |
||
| 254 | 'essential' => $jobPoster->criteria->filter(function($value, $key) { |
||
| 255 | return $value->criteria_type->name == 'essential'; |
||
| 256 | }), |
||
| 257 | 'asset' => $jobPoster->criteria->filter(function($value, $key) { |
||
| 258 | return $value->criteria_type->name == 'asset'; |
||
| 259 | }), |
||
| 260 | ]; |
||
| 261 | |||
| 262 | return view('applicant/application_post_05', [ |
||
|
1 ignored issue
–
show
|
|||
| 263 | |||
| 264 | /* Application Template Data */ |
||
| 265 | "application_step" => 5, |
||
| 266 | "application_template" => Lang::get("applicant/application_template"), |
||
| 267 | "preferred_language_template" => Lang::get('common/preferred_language'), |
||
| 268 | "citizenship_declaration_template" => Lang::get('common/citizenship_declaration'), |
||
| 269 | "veteran_status_template" => Lang::get('common/veteran_status'), |
||
| 270 | |||
| 271 | /* Job Data */ |
||
| 272 | "job" => $jobPoster, |
||
| 273 | |||
| 274 | /* Skills Data */ |
||
| 275 | "skills" => Skill::all(), |
||
| 276 | "skill_template" => Lang::get("common/skills"), |
||
| 277 | "criteria" => $criteria, |
||
| 278 | |||
| 279 | /* Applicant Data */ |
||
| 280 | "applicant" => $applicant, |
||
| 281 | "job_application" => $application, |
||
| 282 | |||
| 283 | /* Submission */ |
||
| 284 | "form_submit_action" => route('job.application.submit', $jobPoster) |
||
| 285 | |||
| 286 | ]); |
||
| 287 | } |
||
| 288 | |||
| 289 | /** |
||
| 290 | * Show the application submission information. |
||
| 291 | * |
||
| 292 | * @param \App\Models\JobPoster $jobPoster |
||
| 293 | * @return \Illuminate\Http\Response |
||
| 294 | */ |
||
| 295 | public function complete(JobPoster $jobPoster) { |
||
| 321 | |||
| 322 | ]); |
||
| 323 | |||
| 324 | } |
||
| 325 | |||
| 326 | /** |
||
| 327 | * Update the Application Basics in storage for the specified job. |
||
| 328 | * |
||
| 329 | * @param \Illuminate\Http\Request $request |
||
| 330 | * @param \App\Models\JobPoster $jobPoster |
||
| 331 | * @return \Illuminate\Http\Response |
||
| 332 | */ |
||
| 333 | public function update_basics(Request $request, JobPoster $jobPoster) |
||
| 334 | { |
||
| 335 | $input = $request->input(); |
||
| 336 | $applicant = Auth::user()->applicant; |
||
| 337 | $application = $this->getApplicationFromJob($jobPoster); |
||
| 338 | |||
| 339 | //Ensure user has permissions to update this application |
||
| 340 | $this->authorize('update', $application); |
||
| 341 | |||
| 342 | $application->fill([ |
||
| 343 | 'citizenship_declaration_id' => $input['citizenship_declaration_id'], |
||
| 344 | 'veteran_status_id' => $input['veteran_status_id'], |
||
| 345 | 'preferred_language_id' => $input['preferred_language_id'], |
||
| 346 | ]); |
||
| 347 | $application->save(); |
||
| 348 | |||
| 349 | $questions = $jobPoster->job_poster_questions; |
||
| 350 | foreach($questions as $question) { |
||
| 351 | $answer = null; |
||
| 352 | if (isset($input['questions']) && |
||
| 353 | isset($input['questions'][$question->id])) { |
||
| 354 | $answer = $input['questions'][$question->id]; |
||
| 355 | } |
||
| 356 | $answerObj = $application->job_application_answers |
||
| 357 | ->firstWhere('job_poster_question_id', $question->id); |
||
| 358 | if ($answerObj == null) { |
||
| 359 | $answerObj = new JobApplicationAnswer(); |
||
| 360 | $answerObj->job_poster_question_id = $question->id; |
||
| 361 | $answerObj->job_application_id = $application->id; |
||
| 362 | } |
||
| 363 | $answerObj->answer = $answer; |
||
| 364 | $answerObj->save(); |
||
| 365 | } |
||
| 366 | |||
| 367 | //Redirect to correct page |
||
| 368 | switch($input['submit']) { |
||
| 369 | case 'save_and_quit': |
||
| 370 | case 'previous': |
||
| 371 | return redirect()->route('applications.index'); |
||
|
1 ignored issue
–
show
|
|||
| 372 | break; |
||
| 373 | case 'save_and_continue': |
||
| 374 | case 'next': |
||
| 375 | return redirect()->route('job.application.edit.2', $jobPoster); |
||
|
1 ignored issue
–
show
|
|||
| 376 | break; |
||
| 377 | default: |
||
| 378 | return redirect()->back()->withInput(); |
||
|
1 ignored issue
–
show
|
|||
| 379 | break; |
||
| 380 | } |
||
| 381 | } |
||
| 382 | |||
| 383 | /** |
||
| 384 | * Update the Application Basics in storage for the specified job. |
||
| 385 | * |
||
| 386 | * @param \Illuminate\Http\Request $request |
||
| 387 | * @param \App\Models\JobPoster $jobPoster |
||
| 388 | * @return \Illuminate\Http\Response |
||
| 389 | */ |
||
| 390 | public function update_experience(Request $request, JobPoster $jobPoster) |
||
| 391 | { |
||
| 392 | $input = $request->input(); |
||
| 393 | $applicant = Auth::user()->applicant; |
||
| 394 | $application = $this->getApplicationFromJob($jobPoster); |
||
| 395 | |||
| 396 | //Ensure user has permissions to update this application |
||
| 397 | $this->authorize('update', $application); |
||
| 398 | |||
| 399 | $degrees = $input['degrees']; |
||
| 400 | |||
| 401 | //Save new degrees |
||
| 402 | if (isset($degrees['new'])) { |
||
| 403 | foreach($degrees['new'] as $degreeInput) { |
||
| 404 | $degree = new Degree(); |
||
| 405 | $degree->applicant_id = $applicant->id; |
||
| 406 | $degree->fill([ |
||
| 407 | 'degree_type_id' => $degreeInput['degree_type_id'], |
||
| 408 | 'area_of_study' => $degreeInput['area_of_study'], |
||
| 409 | 'institution' => $degreeInput['institution'], |
||
| 410 | 'thesis' => $degreeInput['thesis'], |
||
| 411 | 'start_date' => $degreeInput['start_date'], |
||
| 412 | 'end_date' => $degreeInput['end_date'] |
||
| 413 | ]); |
||
| 414 | $degree->save(); |
||
| 415 | } |
||
| 416 | } |
||
| 417 | |||
| 418 | //Update old degrees |
||
| 419 | if (isset($degrees['old'])) { |
||
| 420 | foreach($degrees['old'] as $id=>$degreeInput) { |
||
| 421 | //Ensure this degree belongs to this applicant |
||
| 422 | $degree = $applicant->degrees->firstWhere('id', $id); |
||
| 423 | if ($degree != null) { |
||
| 424 | $degree->fill([ |
||
| 425 | 'degree_type_id' => $degreeInput['degree_type_id'], |
||
| 426 | 'area_of_study' => $degreeInput['area_of_study'], |
||
| 427 | 'institution' => $degreeInput['institution'], |
||
| 428 | 'thesis' => $degreeInput['thesis'], |
||
| 429 | 'start_date' => $degreeInput['start_date'], |
||
| 430 | 'end_date' => $degreeInput['end_date'] |
||
| 431 | ]); |
||
| 432 | $degree->save(); |
||
| 433 | } else { |
||
| 434 | Debugbar::warning('Applicant '.$applicant->id.' attempted to update degree with invalid id '.$id); |
||
| 435 | } |
||
| 436 | } |
||
| 437 | } |
||
| 438 | |||
| 439 | $courses = $input['courses']; |
||
| 440 | |||
| 441 | //Save new courses |
||
| 442 | if (isset($courses['new'])) { |
||
| 443 | foreach($courses['new'] as $courseInput) { |
||
| 444 | $course = new Course(); |
||
| 445 | $course->applicant_id = $applicant->id; |
||
| 446 | $course->fill([ |
||
| 447 | 'name' => $courseInput['name'], |
||
| 448 | 'institution' => $courseInput['institution'], |
||
| 449 | 'course_status_id' => $courseInput['course_status_id'], |
||
| 450 | 'start_date' => $courseInput['start_date'], |
||
| 451 | 'end_date' => $courseInput['end_date'] |
||
| 452 | ]); |
||
| 453 | $course->save(); |
||
| 454 | } |
||
| 455 | } |
||
| 456 | |||
| 457 | //Update old courses |
||
| 458 | if (isset($courses['old'])) { |
||
| 459 | foreach($courses['old'] as $id=>$courseInput) { |
||
| 460 | //Ensure this course belongs to this applicant |
||
| 461 | $course = $applicant->courses->firstWhere('id', $id); |
||
| 462 | if ($course != null) { |
||
| 463 | $course->fill([ |
||
| 464 | 'name' => $courseInput['name'], |
||
| 465 | 'institution' => $courseInput['institution'], |
||
| 466 | 'course_status_id' => $courseInput['course_status_id'], |
||
| 467 | 'start_date' => $courseInput['start_date'], |
||
| 468 | 'end_date' => $courseInput['end_date'] |
||
| 469 | ]); |
||
| 470 | $course->save(); |
||
| 471 | } else { |
||
| 472 | Debugbar::warning('Applicant '.$applicant->id.' attempted to update course with invalid id '.$id); |
||
| 473 | } |
||
| 474 | } |
||
| 475 | } |
||
| 476 | |||
| 477 | $work_experiences = $input['work_experiences'] ; |
||
| 478 | |||
| 479 | //Save new work_experiences |
||
| 480 | if (isset($work_experiences['new'])) { |
||
| 481 | foreach($work_experiences['new'] as $workExperienceInput) { |
||
| 482 | $workExperience = new WorkExperience(); |
||
| 483 | $workExperience->applicant_id = $applicant->id; |
||
| 484 | $workExperience->fill([ |
||
| 485 | 'role' => $workExperienceInput['role'], |
||
| 486 | 'company' => $workExperienceInput['company'], |
||
| 487 | 'description' => $workExperienceInput['description'], |
||
| 488 | 'start_date' => $workExperienceInput['start_date'], |
||
| 489 | 'end_date' => $workExperienceInput['end_date'] |
||
| 490 | ]); |
||
| 491 | $workExperience->save(); |
||
| 492 | } |
||
| 493 | } |
||
| 494 | |||
| 495 | //Update old work_experiences |
||
| 496 | if (isset($work_experiences['old'])) { |
||
| 497 | foreach($work_experiences['old'] as $id=>$workExperienceInput) { |
||
| 498 | //Ensure this work_experience belongs to this applicant |
||
| 499 | $workExperience = $applicant->work_experiences->firstWhere('id', $id); |
||
| 500 | if ($workExperience != null) { |
||
| 501 | $workExperience->fill([ |
||
| 502 | 'role' => $workExperienceInput['role'], |
||
| 503 | 'company' => $workExperienceInput['company'], |
||
| 504 | 'description' => $workExperienceInput['description'], |
||
| 505 | 'start_date' => $workExperienceInput['start_date'], |
||
| 506 | 'end_date' => $workExperienceInput['end_date'] |
||
| 507 | ]); |
||
| 508 | $workExperience->save(); |
||
| 509 | } else { |
||
| 510 | Debugbar::warning('Applicant '.$applicant->id.' attempted to update work_experience with invalid id '.$id); |
||
| 511 | } |
||
| 512 | } |
||
| 513 | } |
||
| 514 | |||
| 515 | //Redirect to correct page |
||
| 516 | switch($input['submit']) { |
||
| 517 | case 'save_and_quit': |
||
| 518 | return redirect()->route('applications.index'); |
||
|
1 ignored issue
–
show
|
|||
| 519 | break; |
||
| 520 | case 'save_and_continue': |
||
| 521 | case 'next': |
||
| 522 | return redirect()->route('job.application.edit.3', $jobPoster); |
||
|
1 ignored issue
–
show
|
|||
| 523 | break; |
||
| 524 | case 'previous': |
||
| 525 | return redirect()->route('job.application.edit.1', $jobPoster); |
||
|
1 ignored issue
–
show
|
|||
| 526 | break; |
||
| 527 | default: |
||
| 528 | return redirect()->back()->withInput(); |
||
|
1 ignored issue
–
show
|
|||
| 529 | break; |
||
| 530 | } |
||
| 531 | } |
||
| 532 | |||
| 533 | /** |
||
| 534 | * Update the Application Essential Skills in storage for the specified job. |
||
| 535 | * |
||
| 536 | * @param \Illuminate\Http\Request $request |
||
| 537 | * @param \App\Models\JobPoster $jobPoster |
||
| 538 | * @return \Illuminate\Http\Response |
||
| 539 | */ |
||
| 540 | public function update_essential_skills(Request $request, JobPoster $jobPoster) |
||
| 541 | { |
||
| 542 | $input = $request->input(); |
||
| 543 | $applicant = Auth::user()->applicant; |
||
| 544 | $application = $this->getApplicationFromJob($jobPoster); |
||
| 545 | |||
| 546 | //Ensure user has permissions to update this application |
||
| 547 | $this->authorize('update', $application); |
||
| 548 | |||
| 549 | $skillDeclarations = $input['skill_declarations']; |
||
| 550 | $claimedStatusId = SkillStatus::where('name', 'claimed')->firstOrFail()->id; |
||
| 551 | |||
| 552 | //Save new skill declarartions |
||
| 553 | if (isset($skillDeclarations['new'])) { |
||
| 554 | foreach($skillDeclarations['new'] as $skillType => $typeInput) { |
||
| 555 | foreach($typeInput as $criterion_id=>$skillDeclarationInput) { |
||
| 556 | $skillDeclaration = new SkillDeclaration(); |
||
| 557 | $skillDeclaration->applicant_id = $applicant->id; |
||
| 558 | $skillDeclaration->skill_id = Criteria::find($criterion_id)->skill->id; |
||
| 559 | $skillDeclaration->skill_status_id = $claimedStatusId; |
||
| 560 | $skillDeclaration->fill([ |
||
| 561 | 'description' => $skillDeclarationInput['description'], |
||
| 562 | 'skill_level_id' => isset($skillDeclarationInput['skill_level_id']) ? $skillDeclarationInput['skill_level_id'] : null, |
||
| 563 | ]); |
||
| 564 | $skillDeclaration->save(); |
||
| 565 | |||
| 566 | $referenceIds = $this->getRelativeIds($skillDeclarationInput, 'references'); |
||
| 567 | $skillDeclaration->references()->sync($referenceIds); |
||
| 568 | |||
| 569 | $sampleIds = $this->getRelativeIds($skillDeclarationInput, 'samples'); |
||
| 570 | $skillDeclaration->work_samples()->sync($sampleIds); |
||
| 571 | } |
||
| 572 | } |
||
| 573 | } |
||
| 574 | |||
| 575 | //Update old declarations |
||
| 576 | if (isset($skillDeclarations['old'])) { |
||
| 577 | foreach($skillDeclarations['old'] as $skillType => $typeInput) { |
||
| 578 | foreach($typeInput as $id=>$skillDeclarationInput) { |
||
| 579 | //Ensure this declaration belongs to this applicant |
||
| 580 | $skillDeclaration = $applicant->skill_declarations->firstWhere('id', $id); |
||
| 581 | if ($skillDeclaration != null) { |
||
| 582 | //skill_id and skill_status cannot be changed |
||
| 583 | $skillDeclaration->fill([ |
||
| 584 | 'description' => $skillDeclarationInput['description'], |
||
| 585 | 'skill_level_id' => isset($skillDeclarationInput['skill_level_id']) ? $skillDeclarationInput['skill_level_id'] : null, |
||
| 586 | ]); |
||
| 587 | $skillDeclaration->save(); |
||
| 588 | |||
| 589 | $referenceIds = $this->getRelativeIds($skillDeclarationInput, 'references'); |
||
| 590 | $skillDeclaration->references()->sync($referenceIds); |
||
| 591 | |||
| 592 | $sampleIds = $this->getRelativeIds($skillDeclarationInput, 'samples'); |
||
| 593 | $skillDeclaration->work_samples()->sync($sampleIds); |
||
| 594 | } else { |
||
| 595 | Debugbar::warning('Applicant '.$applicant->id.' attempted to update skill declaration with invalid id '.$id); |
||
| 596 | } |
||
| 597 | } |
||
| 598 | } |
||
| 599 | } |
||
| 600 | |||
| 601 | //Redirect to correct page |
||
| 602 | switch($input['submit']) { |
||
| 603 | case 'save_and_quit': |
||
| 604 | return redirect()->route('applications.index'); |
||
|
1 ignored issue
–
show
|
|||
| 605 | break; |
||
| 606 | case 'save_and_continue': |
||
| 607 | case 'next': |
||
| 608 | return redirect()->route('job.application.edit.4', $jobPoster); |
||
|
1 ignored issue
–
show
|
|||
| 609 | break; |
||
| 610 | case 'previous': |
||
| 611 | return redirect()->route('job.application.edit.2', $jobPoster); |
||
|
1 ignored issue
–
show
|
|||
| 612 | break; |
||
| 613 | default: |
||
| 614 | return redirect()->back()->withInput(); |
||
|
1 ignored issue
–
show
|
|||
| 615 | break; |
||
| 616 | } |
||
| 617 | } |
||
| 618 | |||
| 619 | /** |
||
| 620 | * Update the Application Asset Skills in storage for the specified job. |
||
| 621 | * |
||
| 622 | * @param \Illuminate\Http\Request $request |
||
| 623 | * @param \App\Models\JobPoster $jobPoster |
||
| 624 | * @return \Illuminate\Http\Response |
||
| 625 | */ |
||
| 626 | public function update_asset_skills(Request $request, JobPoster $jobPoster) |
||
| 702 | } |
||
| 703 | } |
||
| 704 | |||
| 705 | /** |
||
| 706 | * Submit the Application for the specified job. |
||
| 707 | * |
||
| 708 | * @param \Illuminate\Http\Request $request |
||
| 709 | * @param \App\Models\JobPoster $jobPoster |
||
| 710 | * @return \Illuminate\Http\Response |
||
| 711 | */ |
||
| 712 | public function submit(Request $request, JobPoster $jobPoster) |
||
| 766 | } |
||
| 767 | } |
||
| 768 | } |
||
| 769 |