Code Duplication    Length = 20-20 lines in 2 locations

app/Http/Controllers/ApplicationByJobController.php 1 location

@@ 443-462 (lines=20) @@
440
        }
441
442
        // Update old degrees.
443
        if (isset($degrees['old'])) {
444
            foreach ($degrees['old'] as $id => $degreeInput) {
445
                // Ensure this degree belongs to this applicant.
446
                $degree = $applicant->degrees->firstWhere('id', $id);
447
                if ($degree != null) {
448
                    $degree->fill([
449
                        'degree_type_id' => $degreeInput['degree_type_id'],
450
                        'area_of_study' => $degreeInput['area_of_study'],
451
                        'institution' => $degreeInput['institution'],
452
                        'thesis' => $degreeInput['thesis'],
453
                        'start_date' => $degreeInput['start_date'],
454
                        'end_date' => $degreeInput['end_date'],
455
                        'blockcert_url' => $degreeInput['blockcert_url'],
456
                    ]);
457
                    $degree->save();
458
                } else {
459
                    Log::warning("Applicant $applicant->id attempted to update degree with invalid id: $id");
460
                }
461
            }
462
        }
463
464
        $courses = $request->input('courses');
465

app/Http/Controllers/ExperienceController.php 1 location

@@ 98-117 (lines=20) @@
95
        }
96
97
        // Update old degrees.
98
        if (isset($degrees['old'])) {
99
            foreach ($degrees['old'] as $id => $degreeInput) {
100
                // Ensure this degree belongs to this applicant.
101
                $degree = $applicant->degrees->firstWhere('id', $id);
102
                if ($degree != null) {
103
                    $degree->fill([
104
                        'degree_type_id' => $degreeInput['degree_type_id'],
105
                        'area_of_study' => $degreeInput['area_of_study'],
106
                        'institution' => $degreeInput['institution'],
107
                        'thesis' => $degreeInput['thesis'],
108
                        'start_date' => $degreeInput['start_date'],
109
                        'end_date' => $degreeInput['end_date'],
110
                        'blockcert_url' => $degreeInput['blockcert_url'],
111
                    ]);
112
                    $degree->save();
113
                } else {
114
                    Log::warning("Applicant $applicant->id attempted to update degree with invalid id: $id");
115
                }
116
            }
117
        }
118
119
        $courses = $input['courses'];
120