Code Duplication    Length = 14-15 lines in 6 locations

app/Http/Controllers/ApplicationByJobController.php 3 locations

@@ 451-465 (lines=15) @@
448
        ]);
449
450
        //Save new degrees
451
        if (isset($degrees['new'])) {
452
            foreach($degrees['new'] as $degreeInput) {
453
                $degree = new Degree();
454
                $degree->applicant_id = $applicant->id;
455
                $degree->fill([
456
                    'degree_type_id' => $degreeInput['degree_type_id'],
457
                    'area_of_study' => $degreeInput['area_of_study'],
458
                    'institution' => $degreeInput['institution'],
459
                    'thesis' => $degreeInput['thesis'],
460
                    'start_date' => $degreeInput['start_date'],
461
                    'end_date' => $degreeInput['end_date']
462
                ]);
463
                $degree->save();
464
            }
465
        }
466
467
        //Update old degrees
468
        if (isset($degrees['old'])) {
@@ 499-512 (lines=14) @@
496
        ]);
497
498
        //Save new courses
499
        if (isset($courses['new'])) {
500
            foreach($courses['new'] as $courseInput) {
501
                $course = new Course();
502
                $course->applicant_id = $applicant->id;
503
                $course->fill([
504
                    'name' => $courseInput['name'],
505
                    'institution' => $courseInput['institution'],
506
                    'course_status_id' => $courseInput['course_status_id'],
507
                    'start_date' => $courseInput['start_date'],
508
                    'end_date' => $courseInput['end_date']
509
                ]);
510
                $course->save();
511
            }
512
        }
513
514
        //Update old courses
515
        if (isset($courses['old'])) {
@@ 545-558 (lines=14) @@
542
        ]);
543
544
        //Save new work_experiences
545
        if (isset($work_experiences['new'])) {
546
            foreach($work_experiences['new'] as $workExperienceInput) {
547
                $workExperience = new WorkExperience();
548
                $workExperience->applicant_id = $applicant->id;
549
                $workExperience->fill([
550
                    'role' => $workExperienceInput['role'],
551
                    'company' => $workExperienceInput['company'],
552
                    'description' => $workExperienceInput['description'],
553
                    'start_date' => $workExperienceInput['start_date'],
554
                    'end_date' => $workExperienceInput['end_date']
555
                ]);
556
                $workExperience->save();
557
            }
558
        }
559
560
        //Update old work_experiences
561
        if (isset($work_experiences['old'])) {

app/Http/Controllers/ExperienceController.php 3 locations

@@ 82-96 (lines=15) @@
79
        }
80
81
        //Save new degrees
82
        if (isset($degrees['new'])) {
83
            foreach ($degrees['new'] as $degreeInput) {
84
                $degree = new Degree();
85
                $degree->applicant_id = $applicant->id;
86
                $degree->fill([
87
                    'degree_type_id' => $degreeInput['degree_type_id'],
88
                    'area_of_study' => $degreeInput['area_of_study'],
89
                    'institution' => $degreeInput['institution'],
90
                    'thesis' => $degreeInput['thesis'],
91
                    'start_date' => $degreeInput['start_date'],
92
                    'end_date' => $degreeInput['end_date']
93
                ]);
94
                $degree->save();
95
            }
96
        }
97
98
        //Update old degrees
99
        if (isset($degrees['old'])) {
@@ 141-154 (lines=14) @@
138
        }
139
140
        //Save new courses
141
        if (isset($courses['new'])) {
142
            foreach ($courses['new'] as $courseInput) {
143
                $course = new Course();
144
                $course->applicant_id = $applicant->id;
145
                $course->fill([
146
                    'name' => $courseInput['name'],
147
                    'institution' => $courseInput['institution'],
148
                    'course_status_id' => $courseInput['course_status_id'],
149
                    'start_date' => $courseInput['start_date'],
150
                    'end_date' => $courseInput['end_date']
151
                ]);
152
                $course->save();
153
            }
154
        }
155
156
        //Update old courses
157
        if (isset($courses['old'])) {
@@ 198-211 (lines=14) @@
195
        }
196
197
        //Save new work_experiences
198
        if (isset($work_experiences['new'])) {
199
            foreach ($work_experiences['new'] as $workExperienceInput) {
200
                $workExperience = new WorkExperience();
201
                $workExperience->applicant_id = $applicant->id;
202
                $workExperience->fill([
203
                    'role' => $workExperienceInput['role'],
204
                    'company' => $workExperienceInput['company'],
205
                    'description' => $workExperienceInput['description'],
206
                    'start_date' => $workExperienceInput['start_date'],
207
                    'end_date' => $workExperienceInput['end_date']
208
                ]);
209
                $workExperience->save();
210
            }
211
        }
212
213
        //Update old work_experiences
214
        if (isset($work_experiences['old'])) {