Code Duplication    Length = 16-17 lines in 3 locations

app/Api/Controllers/Profile/QualificationsController.php 2 locations

@@ 98-113 (lines=16) @@
95
     *
96
     * @author Bertrand Kintanar <[email protected]>
97
     */
98
    public function updateWorkExperience(QualificationsWorkExperienceRequest $request, WorkExperience $workExperience)
99
    {
100
        $workExperience = $workExperience->whereId($request->get('work_experience_id'))->first();
101
102
        if (!$workExperience) {
103
            return $this->response()->array(['message' => UNABLE_RETRIEVE_MESSAGE, 'status_code' => 422])->statusCode(422);
104
        }
105
106
        try {
107
            $workExperience->update($request->all());
108
        } catch (Exception $e) {
109
            return $this->response()->array(['message' => UNABLE_UPDATE_MESSAGE, 'status_code' => 200])->statusCode(422);
110
        }
111
112
        return $this->response()->array(['message' => SUCCESS_UPDATE_MESSAGE, 'status_code' => 200])->statusCode(200);
113
    }
114
115
    /**
116
     * Save the Profile - Qualifications - Education.
@@ 169-184 (lines=16) @@
166
     *
167
     * @author Bertrand Kintanar <[email protected]>
168
     */
169
    public function updateEducation(QualificationsEducationRequest $request, Education $education)
170
    {
171
        $education = $education->whereId($request->get('education_id'))->first();
172
173
        if (!$education) {
174
            return $this->response()->array(['message' => UNABLE_RETRIEVE_MESSAGE, 'status_code' => 422])->statusCode(422);
175
        }
176
177
        try {
178
            $education->update($request->except(['education_level', 'education_levels']));
179
        } catch (Exception $e) {
180
            return $this->response()->array(['message' => UNABLE_UPDATE_MESSAGE, 'status_code' => 422])->statusCode(422);
181
        }
182
183
        return $this->response()->array(['message' => SUCCESS_UPDATE_MESSAGE, 'status_code' => 200])->statusCode(200);
184
    }
185
186
    /**
187
     * Save the Profile - Qualifications - Skills.

app/Api/Controllers/Admin/Job/JobTitlesController.php 1 location

@@ 139-155 (lines=17) @@
136
     *
137
     * @author Bertrand Kintanar <[email protected]>
138
     */
139
    public function update(JobTitleRequest $request)
140
    {
141
        $job_title = $this->job_title->whereId($request->get('id'))->first();
142
143
        if (!$job_title) {
144
            return $this->response()->array(['message' => UNABLE_RETRIEVE_MESSAGE, 'status_code' => 404])->statusCode(404);
145
        }
146
        try {
147
148
            $job_title->update($request->only(['name', 'description']));
149
        } catch (Exception $e) {
150
151
            return $this->response()->array(['message' => UNABLE_UPDATE_MESSAGE, 'status_code' => 422])->statusCode(422);
152
        }
153
154
        return $this->response()->array(['message' => SUCCESS_UPDATE_MESSAGE, 'status_code' => 200])->statusCode(200);
155
    }
156
}
157