Code Duplication    Length = 38-38 lines in 2 locations

app/Http/Controllers/ApplicationByJobController.php 2 locations

@@ 151-188 (lines=38) @@
148
     * @param  \App\Models\JobPoster $jobPoster Incoming Job Poster object.
149
     * @return \Illuminate\Http\Response
150
     */
151
    public function editEssentialSkills(JobPoster $jobPoster)
152
    {
153
        $applicant = Auth::user()->applicant;
154
        $application = $this->getApplicationFromJob($jobPoster);
155
156
        // Ensure user has permissions to view and update application.
157
        $this->authorize('view', $application);
158
        $this->authorize('update', $application);
159
160
        $criteria = [
161
            'essential' => $jobPoster->criteria->filter(function ($value, $key) {
162
                return $value->criteria_type->name == 'essential';
163
            }),
164
            'asset' => $jobPoster->criteria->filter(function ($value, $key) {
165
                return $value->criteria_type->name == 'asset';
166
            }),
167
        ];
168
169
        return view(
170
            'applicant/application_post_03',
171
            [
172
                // Application Template Data.
173
                'application_step' => 3,
174
                'application_template' => Lang::get('applicant/application_template'),
175
                // Job Data.
176
                'job' => $jobPoster,
177
                // Skills Data.
178
                'skills' => Skill::all(),
179
                'skill_template' => Lang::get('common/skills'),
180
                'criteria' => $criteria,
181
                // Applicant Data.
182
                'applicant' => $applicant,
183
                'job_application' => $application,
184
                // Submission.
185
                'form_submit_action' => route('job.application.update.3', $jobPoster)
186
            ]
187
        );
188
    }
189
190
    /**
191
     * Show the form for editing Application Asset Skills for the specified job.
@@ 196-233 (lines=38) @@
193
     * @param  \App\Models\JobPoster $jobPoster Incoming Job Poster object.
194
     * @return \Illuminate\Http\Response
195
     */
196
    public function editAssetSkills(JobPoster $jobPoster)
197
    {
198
        $applicant = Auth::user()->applicant;
199
        $application = $this->getApplicationFromJob($jobPoster);
200
201
        // Ensure user has permissions to view and update application.
202
        $this->authorize('view', $application);
203
        $this->authorize('update', $application);
204
205
        $criteria = [
206
            'essential' => $jobPoster->criteria->filter(function ($value, $key) {
207
                return $value->criteria_type->name == 'essential';
208
            }),
209
            'asset' => $jobPoster->criteria->filter(function ($value, $key) {
210
                return $value->criteria_type->name == 'asset';
211
            }),
212
        ];
213
214
        return view(
215
            'applicant/application_post_04',
216
            [
217
                // Application Template Data.
218
                'application_step' => 4,
219
                'application_template' => Lang::get('applicant/application_template'),
220
                // Job Data.
221
                'job' => $jobPoster,
222
                // Skills Data.
223
                'skills' => Skill::all(),
224
                'skill_template' => Lang::get('common/skills'),
225
                'criteria' => $criteria,
226
                // Applicant Data.
227
                'applicant' => $applicant,
228
                'job_application' => $application,
229
                // Submission.
230
                'form_submit_action' => route('job.application.update.4', $jobPoster)
231
            ]
232
        );
233
    }
234
235
    /**
236
     * Show the Application Preview for the application for the specified job.