Completed
Pull Request — dev (#330)
by Josh
06:54
created

ApplicationByJobController::edit_experience()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 224
Code Lines 178

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 178
dl 0
loc 224
ccs 0
cts 8
cp 0
rs 8
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace App\Http\Controllers;
4
5
use Barryvdh\Debugbar\Facade as Debugbar;
6
use Illuminate\Support\Facades\Lang;
7
use Illuminate\Http\Request;
8
use App\Models\Lookup\ApplicationStatus;
9
use App\Models\Lookup\VeteranStatus;
10
use App\Models\Lookup\PreferredLanguage;
11
use App\Models\Lookup\CitizenshipDeclaration;
12
use App\Models\Applicant;
13
use App\Models\JobPoster;
14
use App\Models\JobApplication;
15
use App\Models\JobApplicationAnswer;
16
use App\Models\Skill;
17
use App\Models\Degree;
18
use App\Models\Lookup\CriteriaType;
19
use App\Models\Criteria;
20
use App\Models\Course;
21
use App\Models\WorkExperience;
22
use Illuminate\Support\Facades\Auth;
23
24
25
class ApplicationByJobController extends Controller
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class ApplicationByJobController
Loading history...
26
{
27
    /**
28
     * Display a listing of the resource.
29
     *
30
     * @return \Illuminate\Http\Response
31
     */
32
    public function index()
33
    {
34
        //
35
    }
36
37
    /**
38
     * Display the Application for the specified job
39
     *
40
     * @param  \App\Models\JobPoster  $jobPoster
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
41
     * @return \Illuminate\Http\Response
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
42
     */
43
    public function show(JobPoster $jobPoster)
0 ignored issues
show
Unused Code introduced by
The parameter $jobPoster is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

43
    public function show(/** @scrutinizer ignore-unused */ JobPoster $jobPoster)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
44
    {
45
        //
46
    }
47
48
    protected function getApplicationFromJob(JobPoster $jobPoster) {
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function getApplicationFromJob()
Loading history...
49
        $application = JobApplication::where('applicant_id', Auth::user()->applicant->id)
0 ignored issues
show
Bug introduced by
Accessing applicant on the interface Illuminate\Contracts\Auth\Authenticatable suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
50
            ->where('job_poster_id', $jobPoster->id)->first();
51
        if ($application == null) {
52
            $application = new JobApplication();
53
            $application->job_poster_id = $jobPoster->id;
54
            $application->applicant_id = Auth::user()->applicant->id;
55
            $application->application_status_id = ApplicationStatus::where('name', 'draft')->firstOrFail()->id;
56
            $application->save();
57
        }
58
        return $application;
59
    }
60
61
    /**
62
     * Show the form for editing Application basics for the specified job.
63
     *
64
     * @param  \App\Models\JobPoster  $jobPoster
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
65
     * @return \Illuminate\Http\Response
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
66
     */
67
    public function edit_basics(JobPoster $jobPoster)
0 ignored issues
show
Coding Style introduced by
Public method name "ApplicationByJobController::edit_basics" is not in camel caps format
Loading history...
68
    {
69
        $applicant = Auth::user()->applicant;
0 ignored issues
show
Bug introduced by
Accessing applicant on the interface Illuminate\Contracts\Auth\Authenticatable suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
70
        $application = $this->getApplicationFromJob($jobPoster);
71
72
        //This is an alternative way of using policies instead of via middleware
73
        if (!Auth::user()->can('view', $application) ||
74
            !Auth::user()->can('update', $application)) {
0 ignored issues
show
Coding Style introduced by
Each line in a multi-line IF statement must begin with a boolean operator
Loading history...
Coding Style introduced by
Closing parenthesis of a multi-line IF statement must be on a new line
Loading history...
75
            abort(401);
76
        }
77
78
        return view('applicant/application_post_01', [
1 ignored issue
show
Bug Best Practice introduced by
The expression return view('applicant/a..., 'job' => $jobPoster)) returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
79
            "language_options" => PreferredLanguage::all(),
80
            "citizenship_options" => CitizenshipDeclaration::all(),
81
            "veteran_options" => VeteranStatus::all(),
82
            "applicant" => $applicant,
83
            "form_submit_action" => route('job.application.update.1', $jobPoster),
0 ignored issues
show
Bug introduced by
$jobPoster of type App\Models\JobPoster is incompatible with the type array expected by parameter $parameters of route(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

83
            "form_submit_action" => route('job.application.update.1', /** @scrutinizer ignore-type */ $jobPoster),
Loading history...
84
            "application" => [
85
                "id" => "00",
86
                "title" => "Apply Now",
87
                "step" => "1",
88
                "job_context_copy" => "You are applying for:",
89
                "modals" => [
90
                    "00" => [
91
                        "type" => "login",
92
                        "title" => "Register or Login with GC Account",
93
                        "content" => [
94
                            "00" => "Talent Cloud leverages a platform called GC Account that allows you to sign in to a variety of tools using the same account information.",
95
                            "01" => "If you already have a GC Account, please use the Login link below to sign in. If you don't have an account, please use the Register link to create one."
96
                        ],
97
                        "id" => "login",
98
                        "action_01" => "Register",
99
                        "action_02" => "Login"
100
                    ],
101
                    "01" => [
102
                        "type" => "logout",
103
                        "title" => "Logout of Talent Cloud",
104
                        "content" => [
105
                            "00" => "Are you sure you want to logout of Talent Cloud?"
106
                        ],
107
                        "id" => "logout",
108
                        "action_01" => "Cancel",
109
                        "action_02" => "Logout"
110
                    ],
111
                    "02" => [
112
                        "type" => "confirmation",
113
                        "title" => "Delete this Diploma/Degree?",
114
                        "content" => [
115
                            "00" => "Are you sure you want to permanently delete this diploma or degree from your profile?",
116
                            "01" => "All previously submitted applications will retain this experience."
117
                        ],
118
                        "id" => "deleteDegree",
119
                        "action_01" => "Cancel",
120
                        "action_02" => "Delete"
121
                    ],
122
                    "03" => [
123
                        "type" => "confirmation",
124
                        "title" => "Delete this Course/Certification?",
125
                        "content" => [
126
                            "00" => "Are you sure you want to permanently delete this course or certification from your profile?",
127
                            "01" => "All previously submitted applications will retain this experience."
128
                        ],
129
                        "id" => "deleteCourse",
130
                        "action_01" => "Cancel",
131
                        "action_02" => "Delete"
132
                    ],
133
                    "04" => [
134
                        "type" => "confirmation",
135
                        "title" => "Delete this Lived Experience?",
136
                        "content" => [
137
                            "00" => "Are you sure you want to permanently delete this lived experience from your profile?",
138
                            "01" => "All previously submitted applications will retain this experience."
139
                        ],
140
                        "id" => "deleteWork",
141
                        "action_01" => "Cancel",
142
                        "action_02" => "Delete"
143
                    ]
144
                ],
145
                "question_label" => "Your Answer",
146
                "question_title" => "My Fit",
147
                "save_quit_button_label" => "Save & Quit",
148
                "save_continue_button_label" => "Save & Continue",
149
                "claim_title" => "Basic Information",
150
                "language_title" => "Language Selection",
151
                "language_copy" => "Which language would you prefer for this application process?",
152
                "language_label" => "Select One",
153
                "language_options" => [
154
                    "00" => "English",
155
                    "01" => "French"
156
                ],
157
                "citizenship_title" => "Citizenship Claim",
158
                "citizenship_content" => "Which of the following applies to you?",
159
                "citizenship_label" => "Select One",
160
                "citizenship_options" => [
161
                    "00" => "Canadian Citizen",
162
                    "01" => "Permanent Resident of Canada",
163
                    "02" => "Open - Work Permit",
164
                    "03" => "Closed - Work Permit",
165
                    "04" => "I am currently not entitled to work in Canada"
166
                ],
167
                "veterans_title" => "Veterans Claim",
168
                "veterans_content" => "Are you a veteran or a member of the Canadian Armed Forces?",
169
                "veterans_label" => "Select One",
170
                "veterans_options" => [
171
                    "00" => "No - I am not a veteran or a member of the Canadian Armed Forces.",
172
                    "01" => "Yes - I am currently a member of the Canadian Armed Forces.",
173
                    "02" => "Yes - I am a veteran."
174
                ],
175
                "experience_section" => [
176
                    "section_degree_title" => "My Diplomas/Degrees",
177
                    "add_degree_label" => "Add Diploma/Degree",
178
                    "null_degree_copy" => "You don't currently have any diplomas or degrees on your profile! Use the button above to add one.",
179
                    "section_course_title" => "My Courses/Certifications",
180
                    "add_course_label" => "Add Course/Certification",
181
                    "null_course_copy" => "You don't currently have any courses or certifications on your profile! Use the button above to add one.",
182
                    "section_work_title" => "My Lived Experience",
183
                    "add_work_label" => "Add Lived Experience",
184
                    "null_work_copy" => "You don't currently have any lived experience on your profile! Use the button above to add some.",
185
                ]
186
            ],
187
            "job_application" => $application,
188
            "user" => [
189
                "name" => "Jason Greene",
190
                "photo" => false,
191
                "degrees" => [
192
                    "00" => [
193
                        "type" => "Bachelor's Degree",
194
                        "area_of_study" => "Psychology",
195
                        "institution" => "Stanford",
196
                        "thesis" => null,
197
                        "start_date" => "2018-03-01",
198
                        "end_date" => "2018-03-02"
199
                    ]
200
                ],
201
                "courses" => [
202
                    "00" => [
203
                        "name" => "Sample Certification",
204
                        "institution" => "Stanford",
205
                        "status" => "Audited",
206
                        "start_date" => "2018-03-01",
207
                        "end_date" => "2018-03-02"
208
                    ]
209
                ],
210
                "work" => [
211
                    "00" => [
212
                        "role" => "Front-end Developer",
213
                        "company" => "Talent Cloud",
214
                        "description" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ut dolor tincidunt, malesuada enim vel, ullamcorper velit. Donec sit amet commodo libero.",
215
                        "start_date" => "2018-03-01",
216
                        "end_date" => "2018-03-02"
217
                    ]
218
                ],
219
                "skills" => [
220
                    "00" => [
221
                        "name" => "HTML",
222
                        "status" => "Claimed",
223
                        "level" => "beginner",
224
                        "knowledge" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ut dolor tincidunt, malesuada enim vel, ullamcorper velit. Donec sit amet commodo libero. Curabitur gravida consectetur dolor, eu vulputate ligula aliquam in. Praesent tempus lectus et mauris placerat, nec congue lectus placerat.",
225
                        "references" => [
226
                            "00" => "Mark Hamill"
227
                        ],
228
                        "samples" => [
229
                            "00" => "My Website"
230
                        ]
231
                    ],
232
                    "01" => [
233
                        "name" => "CSS",
234
                        "status" => "Claimed",
235
                        "level" => "advanced",
236
                        "knowledge" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ut dolor tincidunt, malesuada enim vel, ullamcorper velit. Donec sit amet commodo libero. Curabitur gravida consectetur dolor, eu vulputate ligula aliquam in. Praesent tempus lectus et mauris placerat, nec congue lectus placerat.",
237
                        "references" => [
238
                            "00" => "Mark Hamill"
239
                        ],
240
                        "samples" => [
241
                            "00" => "My Website"
242
                        ]
243
                    ],
244
                    "02" => [
245
                        "name" => "UX Research",
246
                        "status" => "Claimed",
247
                        "level" => "Moderately in Evidence",
248
                        "knowledge" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ut dolor tincidunt, malesuada enim vel, ullamcorper velit. Donec sit amet commodo libero. Curabitur gravida consectetur dolor, eu vulputate ligula aliquam in. Praesent tempus lectus et mauris placerat, nec congue lectus placerat.",
249
                        "references" => [],
250
                        "samples" => []
251
                    ]
252
                ],
253
                "references" => [
254
                    "00" => [
255
                        "name" => "Mark Hamill",
256
                        "relationship" => "coworker",
257
                        "email" => "[email protected]",
258
                        "description" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ut dolor tincidunt, malesuada enim vel, ullamcorper velit. Donec sit amet commodo libero. Curabitur gravida consectetur dolor, eu vulputate ligula aliquam in. Praesent tempus lectus et mauris placerat, nec congue lectus placerat.",
259
                        "projects" => [
260
                            "00" => [
261
                                "name" => "NAFTA Renegotiation",
262
                                "start_date" => "2018-01-01",
263
                                "end_date" => "2018-02-01"
264
                            ],
265
                            "01" => [
266
                                "name" => "Star Wars XV",
267
                                "start_date" => "2020-09-09",
268
                                "end_date" => "2021-10-10"
269
                            ]
270
                        ],
271
                        "skills" => [
272
                            "00" => "HTML",
273
                            "01" => "CSS"
274
                        ]
275
                    ],
276
                    "01" => [
277
                        "name" => "Jesse Markham"
278
                    ],
279
                    "02" => [
280
                        "name" => "Lucy Ladderfield"
281
                    ],
282
                    "03" => [
283
                        "name" => "Cameron Trovsky"
284
                    ]
285
                ],
286
                "samples" => [
287
                    "00" => [
288
                        "name" => "My Website",
289
                        "type" => "Website",
290
                        "date_created" => "2018-01-01",
291
                        "link" => "https://google.com",
292
                        "description" => "Lorem Ipsum",
293
                        "skills" => [
294
                            "00" => "HTML",
295
                            "01" => "CSS"
296
                        ]
297
                    ]
298
                ]
299
            ],
300
            "job" => $jobPoster,
301
            // "job" => [
302
            //     "link" => "/browse/jobs/00/",
303
            //     "title" => "Front-end Developer",
304
            //     "department" => "Treasury Board of Canada Secretariat",
305
            //     "city" => "Ottawa",
306
            //     "province" => "Ontario",
307
            //     "salary" => "80,000 - 120,000",
308
            //     "duration" => "1 Year",
309
            //     "remote" => "Allowed",
310
            //     "telework" => "Allowed",
311
            //     "time_flexibility" => "Allowed",
312
            //     "days_remaining" => "12",
313
            //     "applicants" => "2",
314
            //     "reference_id" => "14234",
315
            //     "start" => "January 3rd, 2019",
316
            //     "language" => "English Essential",
317
            //     "security" => "Top Secret",
318
            //     "classification" => "CS3",
319
            //     "impact" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat. Sed quis laoreet tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer fringilla at ligula id porttitor. Nullam ac viverra velit, et rhoncus tellus. Praesent in lacus magna. Duis ut vulputate ipsum. In ut ornare elit. Donec id massa felis. Nam at ullamcorper risus. Vestibulum vitae aliquet ex, et ornare libero. Pellentesque sit amet vehicula neque. Donec auctor a erat posuere vehicula.",
320
            //     "work" => [
321
            //         "00" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat.",
322
            //         "01" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat.",
323
            //         "02" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat."
324
            //     ],
325
            //     "criteria" => [
326
            //         "essential" => [
327
            //             "00" => "Criteria 01",
328
            //             "01" => "Criteria 02",
329
            //             "02" => "Criteria 03"
330
            //         ],
331
            //         "asset" => [
332
            //             "00" => "Criteria 01",
333
            //             "01" => "Criteria 02",
334
            //             "02" => "Criteria 03"
335
            //         ]
336
            //     ],
337
            //     "extras" => [
338
            //         "00" => [
339
            //             "title" => "What You Need for Security Clearance",
340
            //             "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
341
            //         ],
342
            //         "01" => [
343
            //             "title" => "The Application Process",
344
            //             "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
345
            //         ],
346
            //         "02" => [
347
            //             "title" => "Other Paperwork & Preparation",
348
            //             "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
349
            //         ]
350
            //     ],
351
            //     "questions" => [
352
            //         "00" => [
353
            //             "value" => "Why are you interested in this job?",
354
            //             "id" => "00",
355
            //             "description" => "We want to know why you are interested in this job instead of other similar ones. This information will be used to help inform a decision to choose between fully qualified candidates at the end of the selection process."
356
            //         ],
357
            //         "01" => [
358
            //             "value" => "Why are you the right person for this job?",
359
            //             "id" => "01",
360
            //             "description" => "Tell us what makes you unique. Why should you stand out from other candidates. This information will be used to help inform a decision to choose between fully qualified candidates at the end of the selection process."
361
            //         ]
362
            //     ]
363
            // ]
364
        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
365
    }
366
367
    /**
368
     * Show the form for editing Application Experience for the specified job.
369
     *
370
     * @param  \App\Models\JobPoster  $jobPoster
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
371
     * @return \Illuminate\Http\Response
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
372
     */
373
    public function edit_experience(JobPoster $jobPoster)
0 ignored issues
show
Coding Style introduced by
Public method name "ApplicationByJobController::edit_experience" is not in camel caps format
Loading history...
374
    {
375
        $applicant = Auth::user()->applicant;
0 ignored issues
show
Bug introduced by
Accessing applicant on the interface Illuminate\Contracts\Auth\Authenticatable suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
376
        $application = $this->getApplicationFromJob($jobPoster);
377
        return view('applicant/application_post_02', [
1 ignored issue
show
Bug Best Practice introduced by
The expression return view('applicant/a..., 'job' => $jobPoster)) returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
378
            "form_submit_action" => route('job.application.update.2', $jobPoster),
0 ignored issues
show
Bug introduced by
$jobPoster of type App\Models\JobPoster is incompatible with the type array expected by parameter $parameters of route(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

378
            "form_submit_action" => route('job.application.update.2', /** @scrutinizer ignore-type */ $jobPoster),
Loading history...
379
            "applicant" => $applicant,
380
            "application" => [
381
                "id" => "00",
382
                "title" => "Apply Now",
383
                "step" => "2",
384
                "job_context_copy" => "You are applying for:",
385
386
                "modals" => [
387
                    "00" => [
388
                        "type" => "login",
389
                        "title" => "Register or Login with GC Account",
390
                        "content" => [
391
                            "00" => "Talent Cloud leverages a platform called GC Account that allows you to sign in to a variety of tools using the same account information.",
392
                            "01" => "If you already have a GC Account, please use the Login link below to sign in. If you don't have an account, please use the Register link to create one."
393
                        ],
394
                        "id" => "login",
395
                        "action_01" => "Register",
396
                        "action_02" => "Login"
397
                    ],
398
                    "01" => [
399
                        "type" => "logout",
400
                        "title" => "Logout of Talent Cloud",
401
                        "content" => [
402
                            "00" => "Are you sure you want to logout of Talent Cloud?"
403
                        ],
404
                        "id" => "logout",
405
                        "action_01" => "Cancel",
406
                        "action_02" => "Logout"
407
                    ],
408
                    "02" => [
409
                        "type" => "deleteConfirmation",
410
                        "title" => "Delete this Diploma/Degree?",
411
                        "content" => [
412
                            "00" => "Are you sure you want to permanently delete this diploma or degree from your profile?",
413
                            "01" => "All previously submitted applications will retain this experience."
414
                        ],
415
                        "id" => "deleteDegree",
416
                        "action_01" => "Cancel",
417
                        "action_02" => "Delete"
418
                    ],
419
                    "03" => [
420
                        "type" => "deleteConfirmation",
421
                        "title" => "Delete this Course/Certification?",
422
                        "content" => [
423
                            "00" => "Are you sure you want to permanently delete this course or certification from your profile?",
424
                            "01" => "All previously submitted applications will retain this experience."
425
                        ],
426
                        "id" => "deleteCourse",
427
                        "action_01" => "Cancel",
428
                        "action_02" => "Delete"
429
                    ],
430
                    "04" => [
431
                        "type" => "deleteConfirmation",
432
                        "title" => "Delete this Lived Experience?",
433
                        "content" => [
434
                            "00" => "Are you sure you want to permanently delete this lived experience from your profile?",
435
                            "01" => "All previously submitted applications will retain this experience."
436
                        ],
437
                        "id" => "deleteWork",
438
                        "action_01" => "Cancel",
439
                        "action_02" => "Delete"
440
                    ]
441
                ],
442
                "experience" => [
443
                    "title" => "My Experience",
444
                    "description" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
445
                ],
446
                "question_title" => "My Fit",
447
                "save_quit_button_label" => "Save & Quit",
448
                "save_continue_button_label" => "Save & Continue",
449
                "language_title" => "Language Requirement",
450
                "language_copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci.",
451
                "language_agree" => "I Agree",
452
                "language_disagree" => "I Disagree",
453
                "citizenship_title" => "Citizenship Claim",
454
                "citizenship_content" => "Which of the following applies to you?",
455
                "citizenship_label" => "Select One",
456
                "citizenship_options" => [
457
                    "00" => "Canadian Citizen",
458
                    "01" => "Permanent Resident of Canada",
459
                    "02" => "Open - Work Permit",
460
                    "03" => "Closed - Work Permit",
461
                    "04" => "I am currently not entitled to work in Canada"
462
                ],
463
                "veterans_title" => "Veterans Claim Claim",
464
                "veterans_content" => "Are you a veteran or a member of the Canadian Armed Forces?",
465
                "veterans_label" => "Select One",
466
                "veterans_options" => [
467
                    "00" => "No - I am not a veteran or a member of the Canadian Armed Forces.",
468
                    "01" => "Yes - I am currently a member of the Canadian Armed Forces.",
469
                    "02" => "Yes - I am a veteran."
470
                ],
471
                "experience_section" => [
472
                    "section_degree_title" => "My Diplomas/Degrees",
473
                    "add_degree_label" => "Add Diploma/Degree",
474
                    "null_degree_copy" => "You don't currently have any diplomas or degrees on your profile! Use the button above to add one.",
475
                    "section_course_title" => "My Courses/Certifications",
476
                    "add_course_label" => "Add Course/Certification",
477
                    "null_course_copy" => "You don't currently have any courses or certifications on your profile! Use the button above to add one.",
478
                    "section_work_title" => "My Lived Experience",
479
                    "add_work_label" => "Add Lived Experience",
480
                    "null_work_copy" => "You don't currently have any lived experience on your profile! Use the button above to add some.",
481
                ]
482
            ],
483
            "user" => [
484
                "name" => "Jason Greene",
485
                "photo" => false,
486
                "degrees" => [
487
                    "00" => [
488
                        "type" => "Bachelor's Degree",
489
                        "area_of_study" => "Psychology",
490
                        "institution" => "Stanford",
491
                        "thesis" => null,
492
                        "start_date" => "2018-03-01",
493
                        "end_date" => "2018-03-02"
494
                    ]
495
                ],
496
                "courses" => [
497
                    "00" => [
498
                        "name" => "Sample Certification",
499
                        "institution" => "Stanford",
500
                        "status" => "Audited",
501
                        "start_date" => "2018-03-01",
502
                        "end_date" => "2018-03-02"
503
                    ]
504
                ],
505
                "work" => [
506
                    "00" => [
507
                        "role" => "Front-end Developer",
508
                        "company" => "Talent Cloud",
509
                        "description" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ut dolor tincidunt, malesuada enim vel, ullamcorper velit. Donec sit amet commodo libero.",
510
                        "start_date" => "2018-03-01",
511
                        "end_date" => "2018-03-02"
512
                    ]
513
                ],
514
                "skills" => [
515
                    "00" => [
516
                        "name" => "HTML",
517
                        "status" => "Claimed",
518
                        "level" => "beginner",
519
                        "knowledge" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ut dolor tincidunt, malesuada enim vel, ullamcorper velit. Donec sit amet commodo libero. Curabitur gravida consectetur dolor, eu vulputate ligula aliquam in. Praesent tempus lectus et mauris placerat, nec congue lectus placerat.",
520
                        "references" => [
521
                            "00" => "Mark Hamill"
522
                        ],
523
                        "samples" => [
524
                            "00" => "My Website"
525
                        ]
526
                    ],
527
                    "01" => [
528
                        "name" => "CSS",
529
                        "status" => "Claimed",
530
                        "level" => "advanced",
531
                        "knowledge" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ut dolor tincidunt, malesuada enim vel, ullamcorper velit. Donec sit amet commodo libero. Curabitur gravida consectetur dolor, eu vulputate ligula aliquam in. Praesent tempus lectus et mauris placerat, nec congue lectus placerat.",
532
                        "references" => [
533
                            "00" => "Mark Hamill"
534
                        ],
535
                        "samples" => [
536
                            "00" => "My Website"
537
                        ]
538
                    ],
539
                    "02" => [
540
                        "name" => "UX Research",
541
                        "status" => "Claimed",
542
                        "level" => "Moderately in Evidence",
543
                        "knowledge" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ut dolor tincidunt, malesuada enim vel, ullamcorper velit. Donec sit amet commodo libero. Curabitur gravida consectetur dolor, eu vulputate ligula aliquam in. Praesent tempus lectus et mauris placerat, nec congue lectus placerat.",
544
                        "references" => [],
545
                        "samples" => []
546
                    ]
547
                ],
548
                "references" => [
549
                    "00" => [
550
                        "name" => "Mark Hamill",
551
                        "relationship" => "coworker",
552
                        "email" => "[email protected]",
553
                        "description" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ut dolor tincidunt, malesuada enim vel, ullamcorper velit. Donec sit amet commodo libero. Curabitur gravida consectetur dolor, eu vulputate ligula aliquam in. Praesent tempus lectus et mauris placerat, nec congue lectus placerat.",
554
                        "projects" => [
555
                            "00" => [
556
                                "name" => "NAFTA Renegotiation",
557
                                "start_date" => "2018-01-01",
558
                                "end_date" => "2018-02-01"
559
                            ],
560
                            "01" => [
561
                                "name" => "Star Wars XV",
562
                                "start_date" => "2020-09-09",
563
                                "end_date" => "2021-10-10"
564
                            ]
565
                        ],
566
                        "skills" => [
567
                            "00" => "HTML",
568
                            "01" => "CSS"
569
                        ]
570
                    ],
571
                    "01" => [
572
                        "name" => "Jesse Markham"
573
                    ],
574
                    "02" => [
575
                        "name" => "Lucy Ladderfield"
576
                    ],
577
                    "03" => [
578
                        "name" => "Cameron Trovsky"
579
                    ]
580
                ],
581
                "samples" => [
582
                    "00" => [
583
                        "name" => "My Website",
584
                        "type" => "Website",
585
                        "date_created" => "2018-01-01",
586
                        "link" => "https://google.com",
587
                        "description" => "Lorem Ipsum",
588
                        "skills" => [
589
                            "00" => "HTML",
590
                            "01" => "CSS"
591
                        ]
592
                    ]
593
                ]
594
            ],
595
            "job_application" => $application,
596
            "job" => $jobPoster,
597
            // [
598
            //     "id" => $jobPoster->id,
599
            //     "link" => "/browse/jobs/00/",
600
            //     "title" => "Front-end Developer",
601
            //     "department" => "Treasury Board of Canada Secretariat",
602
            //     "city" => "Ottawa",
603
            //     "province" => "Ontario",
604
            //     "salary" => "80,000 - 120,000",
605
            //     "duration" => "1 Year",
606
            //     "remote" => "Allowed",
607
            //     "telework" => "Allowed",
608
            //     "time_flexibility" => "Allowed",
609
            //     "days_remaining" => "12",
610
            //     "applicants" => "2",
611
            //     "reference_id" => "14234",
612
            //     "start" => "January 3rd, 2019",
613
            //     "language" => "English Essential",
614
            //     "security" => "Top Secret",
615
            //     "classification" => "CS3",
616
            //     "impact" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat. Sed quis laoreet tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer fringilla at ligula id porttitor. Nullam ac viverra velit, et rhoncus tellus. Praesent in lacus magna. Duis ut vulputate ipsum. In ut ornare elit. Donec id massa felis. Nam at ullamcorper risus. Vestibulum vitae aliquet ex, et ornare libero. Pellentesque sit amet vehicula neque. Donec auctor a erat posuere vehicula.",
617
            //     "work" => [
618
            //         "00" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat.",
619
            //         "01" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat.",
620
            //         "02" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat."
621
            //     ],
622
            //     "criteria" => [
623
            //         "essential" => [
624
            //             "00" => "Criteria 01",
625
            //             "01" => "Criteria 02",
626
            //             "02" => "Criteria 03"
627
            //         ],
628
            //         "asset" => [
629
            //             "00" => "Criteria 01",
630
            //             "01" => "Criteria 02",
631
            //             "02" => "Criteria 03"
632
            //         ]
633
            //     ],
634
            //     "extras" => [
635
            //         "00" => [
636
            //             "title" => "What You Need for Security Clearance",
637
            //             "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
638
            //         ],
639
            //         "01" => [
640
            //             "title" => "The Application Process",
641
            //             "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
642
            //         ],
643
            //         "02" => [
644
            //             "title" => "Other Paperwork & Preparation",
645
            //             "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
646
            //         ]
647
            //     ],
648
            //     "questions" => [
649
            //         "00" => [
650
            //             "value" => "Why are you interested in this job?",
651
            //             "description" => "We want to know why you are interested in this job instead of other similar ones. This information will be used to help inform a decision to choose between fully qualified candidates at the end of the selection process.",
652
            //             "input_name" => "jobPostQuestion0",
653
            //             "answer_label" => "Your Answer",
654
            //             "answer" => null
655
            //         ],
656
            //         "01" => [
657
            //             "value" => "Why are you the right person for this job?",
658
            //             "description" => "Tell us what makes you unique. Why should you stand out from other candidates. This information will be used to help inform a decision to choose between fully qualified candidates at the end of the selection process.",
659
            //             "input_name" => "jobPostQuestion1",
660
            //             "answer_label" => "Your Answer",
661
            //             "answer" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
662
            //         ]
663
            //     ]
664
            // ]
665
        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
666
    }
667
668
    /**
669
     * Show the form for editing Application Essential Skills for the specified job.
670
     *
671
     * @param  \App\Models\JobPoster  $jobPoster
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
672
     * @return \Illuminate\Http\Response
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
673
     */
674
    public function edit_essential_skills(JobPoster $jobPoster)
0 ignored issues
show
Coding Style introduced by
Public method name "ApplicationByJobController::edit_essential_skills" is not in camel caps format
Loading history...
675
    {
676
        $applicant = Auth::user()->applicant;
0 ignored issues
show
Bug introduced by
Accessing applicant on the interface Illuminate\Contracts\Auth\Authenticatable suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
677
        $application = $this->getApplicationFromJob($jobPoster);
678
        $criteria = [
679
            'essential' => $jobPoster->criteria->filter(function($value, $key) {
0 ignored issues
show
Unused Code introduced by
The parameter $key is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

679
            'essential' => $jobPoster->criteria->filter(function($value, /** @scrutinizer ignore-unused */ $key) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
680
                return $value->criteria_type->name == 'essential';
681
            }),
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
682
            'asset' => $jobPoster->criteria->filter(function($value, $key) {
0 ignored issues
show
Unused Code introduced by
The parameter $key is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

682
            'asset' => $jobPoster->criteria->filter(function($value, /** @scrutinizer ignore-unused */ $key) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
683
                return $value->criteria_type->name == 'asset';
684
            }),
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
685
        ];
686
687
        return view('applicant/application_post_03', [
1 ignored issue
show
Bug Best Practice introduced by
The expression return view('applicant/a...p\Models\Skill::all())) returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
688
            "applicant" => $applicant,
689
            'skill_template' => Lang::get('common/skills'),
690
            "form_submit_action" => route('job.application.update.3', $jobPoster),
0 ignored issues
show
Bug introduced by
$jobPoster of type App\Models\JobPoster is incompatible with the type array expected by parameter $parameters of route(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

690
            "form_submit_action" => route('job.application.update.3', /** @scrutinizer ignore-type */ $jobPoster),
Loading history...
691
            'criteria' => $criteria,
692
            "application" => [
693
                "id" => "00",
694
                "title" => "Apply Now",
695
                "step" => "3",
696
                "job_context_copy" => "You are applying for:",
697
698
                "skills_section" => [
699
                    "essential_title" => "Need to Have",
700
                    "asset_title" => "Nice to Have",
701
                    "add_button_label" => "Add Skill",
702
                    "null_copy" => "You don't currently have any skills on your profile! Use the button above to add a skill."
703
                ],
704
705
                "modals" => [
706
                    "00" => [
707
                        "type" => "createReference",
708
                        "title" => "Create a New Reference",
709
                        "content" => [
710
                            "00" => "By submitting a reference you agree to having first asked their permission to provide their information. Please note that all information provided within a reference might be sent to said reference during a hiring process."
711
                        ],
712
                        "id" => "createReference",
713
                        "action_01" => "Cancel",
714
                        "action_02" => "Save"
715
                    ],
716
                    "01" => [
717
                        "type" => "createSample",
718
                        "title" => "Create a New Work Sample",
719
                        "content" => [
720
                        ],
721
                        "id" => "createSample",
722
                        "action_01" => "Cancel",
723
                        "action_02" => "Save"
724
                    ]
725
                ],
726
                "question_title" => "My Fit",
727
                "save_quit_button_label" => "Save & Quit",
728
                "save_continue_button_label" => "Save & Continue",
729
                "essential_title" => "Skills You Need to Have",
730
                "asset_title" => "Skills That Are Nice to Have",
731
                "essential_context" => "This text is intended to explain the difference between essential and asset criteria while providing context for micro-references and work samples.",
732
                "asset_context" => "This text is intended to explain the difference between essential and asset criteria while providing context for micro-references and work samples.",
733
                "essential_start_button_title" => "Scroll to begin filling out the skills you need to have.",
734
                "asset_start_button_title" => "Scroll to begin filling out the skills that are nice to have.",
735
                "skills_start_button_label" => "Get Started",
736
                "essential_sidebar_label" => "Skills Checklist",
737
                "asset_sidebar_label" => "Skills Checklist",
738
                "sidebar_item_title" => "Scroll to this skill.",
739
                "skill_ui" => [
740
                    "declaration_title" => "Required Information",
741
                    "declaration_level_help_label" => "Unsure of your level?",
742
                    "declaration_expertise_title" => "My Level of Expertise",
743
                    "declaration_expertise" => [
744
                        "Beginner",
745
                        "Intermediate",
746
                        "Expert",
747
                        "Master"
748
                    ],
749
                    "declaration_experience_title" => "My Years of Experience",
750
                    "declaration_experience" => [
751
                        "1 of Less",
752
                        "2 - 3",
753
                        "4 - 5",
754
                        "6 - 7",
755
                        "8 or More"
756
                    ],
757
                    "declaration_knowledge_label" => "My Knowledge & Experience",
758
                    "reference" => [
759
                        "add_title" => "Add an optional reference.",
760
                        "add_context" => "Appoint someone who can vouch for your ability in this skill."
761
                    ],
762
                    "sample" => [
763
                        "add_title" => "Add an optional work sample.",
764
                        "add_context" => "Provide a link to a sample of your work that showcases this skill."
765
                    ],
766
                    "save_button_label" => "Save",
767
                    "delete_button_label" => "Remove"
768
                ]
769
            ],
770
            "user" => [
771
                "name" => "Jason Greene",
772
                "photo" => false,
773
                "skills" => [
774
                    "00" => [
775
                        "name" => "HTML",
776
                        "status" => "Claimed",
777
                        "level" => "beginner",
778
                        "knowledge" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ut dolor tincidunt, malesuada enim vel, ullamcorper velit. Donec sit amet commodo libero. Curabitur gravida consectetur dolor, eu vulputate ligula aliquam in. Praesent tempus lectus et mauris placerat, nec congue lectus placerat.",
779
                        "references" => [
780
                            "00" => "Mark Hamill"
781
                        ],
782
                        "samples" => [
783
                            "00" => "My Website"
784
                        ]
785
                    ],
786
                    "01" => [
787
                        "name" => "CSS",
788
                        "status" => "Claimed",
789
                        "level" => "advanced",
790
                        "knowledge" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ut dolor tincidunt, malesuada enim vel, ullamcorper velit. Donec sit amet commodo libero. Curabitur gravida consectetur dolor, eu vulputate ligula aliquam in. Praesent tempus lectus et mauris placerat, nec congue lectus placerat.",
791
                        "references" => [
792
                            "00" => "Mark Hamill"
793
                        ],
794
                        "samples" => [
795
                            "00" => "My Website"
796
                        ]
797
                    ],
798
                    "02" => [
799
                        "name" => "UX Research",
800
                        "status" => "Claimed",
801
                        "level" => "Moderately in Evidence",
802
                        "knowledge" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ut dolor tincidunt, malesuada enim vel, ullamcorper velit. Donec sit amet commodo libero. Curabitur gravida consectetur dolor, eu vulputate ligula aliquam in. Praesent tempus lectus et mauris placerat, nec congue lectus placerat.",
803
                        "references" => [],
804
                        "samples" => []
805
                    ]
806
                ],
807
                "references" => [
808
                    "00" => [
809
                        "name" => "Mark Hamill"
810
                    ],
811
                    "01" => [
812
                        "name" => "Jesse Markham"
813
                    ],
814
                    "02" => [
815
                        "name" => "Lucy Ladderfield"
816
                    ],
817
                    "03" => [
818
                        "name" => "Cameron Trovsky"
819
                    ]
820
                ],
821
                "samples" => [
822
                    "00" => [
823
                        "name" => "My Website",
824
                        "type" => "Website",
825
                        "date_created" => "2018-01-01",
826
                        "link" => "https://google.com",
827
                        "description" => "Lorem Ipsum",
828
                        "skills" => [
829
                            "00" => "HTML",
830
                            "01" => "CSS"
831
                        ]
832
                    ]
833
                ]
834
            ],
835
            "job_application" => $application,
836
            "job" => $jobPoster,
837
            // "job" => [
838
            //     "id" => $jobPoster->id,
839
            //     "link" => "/browse/jobs/00/",
840
            //     "title" => "Front-end Developer",
841
            //     "department" => "Treasury Board of Canada Secretariat",
842
            //     "city" => "Ottawa",
843
            //     "province" => "Ontario",
844
            //     "salary" => "80,000 - 120,000",
845
            //     "duration" => "1 Year",
846
            //     "remote" => "Allowed",
847
            //     "telework" => "Allowed",
848
            //     "time_flexibility" => "Allowed",
849
            //     "days_remaining" => "12",
850
            //     "applicants" => "2",
851
            //     "reference_id" => "14234",
852
            //     "start" => "January 3rd, 2019",
853
            //     "language" => "English Essential",
854
            //     "security" => "Top Secret",
855
            //     "classification" => "CS3",
856
            //     "impact" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat. Sed quis laoreet tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer fringilla at ligula id porttitor. Nullam ac viverra velit, et rhoncus tellus. Praesent in lacus magna. Duis ut vulputate ipsum. In ut ornare elit. Donec id massa felis. Nam at ullamcorper risus. Vestibulum vitae aliquet ex, et ornare libero. Pellentesque sit amet vehicula neque. Donec auctor a erat posuere vehicula.",
857
            //     "work" => [
858
            //         "00" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat.",
859
            //         "01" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat.",
860
            //         "02" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat."
861
            //     ],
862
            //     "criteria" => [
863
            //         "essential" => [
864
            //             "00" => "Criteria 01",
865
            //             "01" => "Criteria 02",
866
            //             "02" => "Criteria 03"
867
            //         ],
868
            //         "asset" => [
869
            //             "00" => "Criteria 01",
870
            //             "01" => "Criteria 02",
871
            //             "02" => "Criteria 03"
872
            //         ]
873
            //     ],
874
            //     "extras" => [
875
            //         "00" => [
876
            //             "title" => "What You Need for Security Clearance",
877
            //             "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
878
            //         ],
879
            //         "01" => [
880
            //             "title" => "The Application Process",
881
            //             "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
882
            //         ],
883
            //         "02" => [
884
            //             "title" => "Other Paperwork & Preparation",
885
            //             "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
886
            //         ]
887
            //     ],
888
            //     "questions" => [
889
            //         "00" => [
890
            //             "value" => "Why are you interested in this job?",
891
            //             "description" => "We want to know why you are interested in this job instead of other similar ones. This information will be used to help inform a decision to choose between fully qualified candidates at the end of the selection process.",
892
            //             "input_name" => "jobPostQuestion0",
893
            //             "answer_label" => "Your Answer",
894
            //             "answer" => null
895
            //         ],
896
            //         "01" => [
897
            //             "value" => "Why are you the right person for this job?",
898
            //             "description" => "Tell us what makes you unique. Why should you stand out from other candidates. This information will be used to help inform a decision to choose between fully qualified candidates at the end of the selection process.",
899
            //             "input_name" => "jobPostQuestion1",
900
            //             "answer_label" => "Your Answer",
901
            //             "answer" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
902
            //         ]
903
            //     ],
904
            //     "skills" => [
905
            //         "00" => [
906
            //             "name" => "HTML",
907
            //             "requirement" => "essential",
908
            //             "level" => "Intermediate"
909
            //         ],
910
            //         "01" => [
911
            //             "name" => "JavaScript",
912
            //             "requirement" => "essential",
913
            //             "level" => "Moderately in Evidence"
914
            //         ],
915
            //         "02" => [
916
            //             "name" => "CSS",
917
            //             "requirement" => "essential",
918
            //             "level" => "Advanced"
919
            //         ],
920
            //         "03" => [
921
            //             "name" => "Laravel",
922
            //             "requirement" => "essential",
923
            //             "level" => "Intermediate"
924
            //         ],
925
            //         "04" => [
926
            //             "name" => "Docker",
927
            //             "requirement" => "asset",
928
            //             "level" => "In Early Development"
929
            //         ],
930
            //         "05" => [
931
            //             "name" => "Responsive Web Design",
932
            //             "requirement" => "asset",
933
            //             "level" => "In Early Development"
934
            //         ],
935
            //         "06" => [
936
            //             "name" => "Adobe XD",
937
            //             "requirement" => "asset",
938
            //             "level" => "In Early Development"
939
            //         ]
940
            //     ]
941
            // ],
942
            "skills" => Skill::all(),
943
        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
944
    }
945
946
    /**
947
     * Show the form for editing Application Asset Skills for the specified job.
948
     *
949
     * @param  \App\Models\JobPoster  $jobPoster
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
950
     * @return \Illuminate\Http\Response
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
951
     */
952
    public function edit_asset_skills(JobPoster $jobPoster)
0 ignored issues
show
Coding Style introduced by
Public method name "ApplicationByJobController::edit_asset_skills" is not in camel caps format
Loading history...
953
    {
954
        $applicant = Auth::user()->applicant;
0 ignored issues
show
Bug introduced by
Accessing applicant on the interface Illuminate\Contracts\Auth\Authenticatable suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
955
        $application = $this->getApplicationFromJob($jobPoster);
956
        $criteria = [
957
            'essential' => $jobPoster->criteria->filter(function($value, $key) {
0 ignored issues
show
Unused Code introduced by
The parameter $key is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

957
            'essential' => $jobPoster->criteria->filter(function($value, /** @scrutinizer ignore-unused */ $key) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
958
                return $value->criteria_type->name == 'essential';
959
            }),
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
960
            'asset' => $jobPoster->criteria->filter(function($value, $key) {
0 ignored issues
show
Unused Code introduced by
The parameter $key is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

960
            'asset' => $jobPoster->criteria->filter(function($value, /** @scrutinizer ignore-unused */ $key) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
961
                return $value->criteria_type->name == 'asset';
962
            }),
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
963
        ];
964
965
        return view('applicant/application_post_04', [
1 ignored issue
show
Bug Best Practice introduced by
The expression return view('applicant/a...p\Models\Skill::all())) returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
966
            "applicant" => $applicant,
967
            'skill_template' => Lang::get('common/skills'),
968
            "form_submit_action" => route('job.application.update.4', $jobPoster),
0 ignored issues
show
Bug introduced by
$jobPoster of type App\Models\JobPoster is incompatible with the type array expected by parameter $parameters of route(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

968
            "form_submit_action" => route('job.application.update.4', /** @scrutinizer ignore-type */ $jobPoster),
Loading history...
969
            'criteria' => $criteria,
970
            "application" => [
971
                "id" => "00",
972
                "title" => "Apply Now",
973
                "step" => "4",
974
                "job_context_copy" => "You are applying for:",
975
976
                "skills_section" => [
977
                    "essential_title" => "Need to Have",
978
                    "asset_title" => "Nice to Have",
979
                    "add_button_label" => "Add Skill",
980
                    "null_copy" => "You don't currently have any skills on your profile! Use the button above to add a skill."
981
                ],
982
983
                "modals" => [
984
                    "00" => [
985
                        "type" => "createReference",
986
                        "title" => "Create a New Reference",
987
                        "content" => [
988
                            "00" => "By submitting a reference you agree to having first asked their permission to provide their information. Please note that all information provided within a reference might be sent to said reference during a hiring process."
989
                        ],
990
                        "id" => "createReference",
991
                        "action_01" => "Cancel",
992
                        "action_02" => "Save"
993
                    ],
994
                    "01" => [
995
                        "type" => "createSample",
996
                        "title" => "Create a New Work Sample",
997
                        "content" => [
998
                        ],
999
                        "id" => "createSample",
1000
                        "action_01" => "Cancel",
1001
                        "action_02" => "Save"
1002
                    ]
1003
                ],
1004
                "question_title" => "My Fit",
1005
                "save_quit_button_label" => "Save & Quit",
1006
                "save_continue_button_label" => "Save & Continue",
1007
                "essential_title" => "Skills You Need to Have",
1008
                "asset_title" => "Skills That Are Nice to Have",
1009
                "essential_context" => "This text is intended to explain the difference between essential and asset criteria while providing context for micro-references and work samples.",
1010
                "asset_context" => "This text is intended to explain the difference between essential and asset criteria while providing context for micro-references and work samples.",
1011
                "essential_start_button_title" => "Scroll to begin filling out the skills you need to have.",
1012
                "asset_start_button_title" => "Scroll to begin filling out the skills that are nice to have.",
1013
                "skills_start_button_label" => "Get Started",
1014
                "essential_sidebar_label" => "Skills Checklist",
1015
                "asset_sidebar_label" => "Skills Checklist",
1016
                "sidebar_item_title" => "Scroll to this skill.",
1017
                "skill_ui" => [
1018
                    "declaration_title" => "Required Information",
1019
                    "declaration_level_help_label" => "Unsure of your level?",
1020
                    "declaration_expertise_title" => "My Level of Expertise",
1021
                    "declaration_expertise" => [
1022
                        "Beginner",
1023
                        "Intermediate",
1024
                        "Expert",
1025
                        "Master"
1026
                    ],
1027
                    "declaration_experience_title" => "My Years of Experience",
1028
                    "declaration_experience" => [
1029
                        "1 of Less",
1030
                        "2 - 3",
1031
                        "4 - 5",
1032
                        "6 - 7",
1033
                        "8 or More"
1034
                    ],
1035
                    "declaration_knowledge_label" => "My Knowledge & Experience",
1036
                    "reference" => [
1037
                        "add_title" => "Add an optional reference.",
1038
                        "add_context" => "Appoint someone who can vouch for your ability in this skill."
1039
                    ],
1040
                    "sample" => [
1041
                        "add_title" => "Add an optional work sample.",
1042
                        "add_context" => "Provide a link to a sample of your work that showcases this skill."
1043
                    ],
1044
                    "save_button_label" => "Save",
1045
                    "delete_button_label" => "Remove"
1046
                ]
1047
            ],
1048
            "user" => [
1049
                "name" => "Jason Greene",
1050
                "photo" => false,
1051
                "skills" => [
1052
                    "00" => [
1053
                        "name" => "HTML",
1054
                        "status" => "Claimed",
1055
                        "level" => "beginner",
1056
                        "knowledge" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ut dolor tincidunt, malesuada enim vel, ullamcorper velit. Donec sit amet commodo libero. Curabitur gravida consectetur dolor, eu vulputate ligula aliquam in. Praesent tempus lectus et mauris placerat, nec congue lectus placerat.",
1057
                        "references" => [
1058
                            "00" => "Mark Hamill"
1059
                        ],
1060
                        "samples" => [
1061
                            "00" => "My Website"
1062
                        ]
1063
                    ],
1064
                    "01" => [
1065
                        "name" => "CSS",
1066
                        "status" => "Claimed",
1067
                        "level" => "advanced",
1068
                        "knowledge" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ut dolor tincidunt, malesuada enim vel, ullamcorper velit. Donec sit amet commodo libero. Curabitur gravida consectetur dolor, eu vulputate ligula aliquam in. Praesent tempus lectus et mauris placerat, nec congue lectus placerat.",
1069
                        "references" => [
1070
                            "00" => "Mark Hamill"
1071
                        ],
1072
                        "samples" => [
1073
                            "00" => "My Website"
1074
                        ]
1075
                    ],
1076
                    "02" => [
1077
                        "name" => "UX Research",
1078
                        "status" => "Claimed",
1079
                        "level" => "Moderately in Evidence",
1080
                        "knowledge" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ut dolor tincidunt, malesuada enim vel, ullamcorper velit. Donec sit amet commodo libero. Curabitur gravida consectetur dolor, eu vulputate ligula aliquam in. Praesent tempus lectus et mauris placerat, nec congue lectus placerat.",
1081
                        "references" => [],
1082
                        "samples" => []
1083
                    ]
1084
                ],
1085
                "references" => [
1086
                    "00" => [
1087
                        "name" => "Mark Hamill"
1088
                    ],
1089
                    "01" => [
1090
                        "name" => "Jesse Markham"
1091
                    ],
1092
                    "02" => [
1093
                        "name" => "Lucy Ladderfield"
1094
                    ],
1095
                    "03" => [
1096
                        "name" => "Cameron Trovsky"
1097
                    ]
1098
                ],
1099
                "samples" => [
1100
                    "00" => [
1101
                        "name" => "My Website",
1102
                        "type" => "Website",
1103
                        "date_created" => "2018-01-01",
1104
                        "link" => "https://google.com",
1105
                        "description" => "Lorem Ipsum",
1106
                        "skills" => [
1107
                            "00" => "HTML",
1108
                            "01" => "CSS"
1109
                        ]
1110
                    ]
1111
                ]
1112
            ],
1113
            "job_application" => $application,
1114
            "job" => $jobPoster,
1115
            // "job" => [
1116
            //     "id" => $jobPoster->id,
1117
            //     "link" => "/browse/jobs/00/",
1118
            //     "title" => "Front-end Developer",
1119
            //     "department" => "Treasury Board of Canada Secretariat",
1120
            //     "city" => "Ottawa",
1121
            //     "province" => "Ontario",
1122
            //     "salary" => "80,000 - 120,000",
1123
            //     "duration" => "1 Year",
1124
            //     "remote" => "Allowed",
1125
            //     "telework" => "Allowed",
1126
            //     "time_flexibility" => "Allowed",
1127
            //     "days_remaining" => "12",
1128
            //     "applicants" => "2",
1129
            //     "reference_id" => "14234",
1130
            //     "start" => "January 3rd, 2019",
1131
            //     "language" => "English Essential",
1132
            //     "security" => "Top Secret",
1133
            //     "classification" => "CS3",
1134
            //     "impact" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat. Sed quis laoreet tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer fringilla at ligula id porttitor. Nullam ac viverra velit, et rhoncus tellus. Praesent in lacus magna. Duis ut vulputate ipsum. In ut ornare elit. Donec id massa felis. Nam at ullamcorper risus. Vestibulum vitae aliquet ex, et ornare libero. Pellentesque sit amet vehicula neque. Donec auctor a erat posuere vehicula.",
1135
            //     "work" => [
1136
            //         "00" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat.",
1137
            //         "01" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat.",
1138
            //         "02" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat."
1139
            //     ],
1140
            //     "criteria" => [
1141
            //         "essential" => [
1142
            //             "00" => "Criteria 01",
1143
            //             "01" => "Criteria 02",
1144
            //             "02" => "Criteria 03"
1145
            //         ],
1146
            //         "asset" => [
1147
            //             "00" => "Criteria 01",
1148
            //             "01" => "Criteria 02",
1149
            //             "02" => "Criteria 03"
1150
            //         ]
1151
            //     ],
1152
            //     "extras" => [
1153
            //         "00" => [
1154
            //             "title" => "What You Need for Security Clearance",
1155
            //             "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
1156
            //         ],
1157
            //         "01" => [
1158
            //             "title" => "The Application Process",
1159
            //             "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
1160
            //         ],
1161
            //         "02" => [
1162
            //             "title" => "Other Paperwork & Preparation",
1163
            //             "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
1164
            //         ]
1165
            //     ],
1166
            //     "questions" => [
1167
            //         "00" => [
1168
            //             "value" => "Why are you interested in this job?",
1169
            //             "description" => "We want to know why you are interested in this job instead of other similar ones. This information will be used to help inform a decision to choose between fully qualified candidates at the end of the selection process.",
1170
            //             "input_name" => "jobPostQuestion0",
1171
            //             "answer_label" => "Your Answer",
1172
            //             "answer" => null
1173
            //         ],
1174
            //         "01" => [
1175
            //             "value" => "Why are you the right person for this job?",
1176
            //             "description" => "Tell us what makes you unique. Why should you stand out from other candidates. This information will be used to help inform a decision to choose between fully qualified candidates at the end of the selection process.",
1177
            //             "input_name" => "jobPostQuestion1",
1178
            //             "answer_label" => "Your Answer",
1179
            //             "answer" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
1180
            //         ]
1181
            //     ],
1182
            //     "skills" => [
1183
            //         "00" => [
1184
            //             "name" => "HTML",
1185
            //             "requirement" => "essential",
1186
            //             "level" => "Intermediate"
1187
            //         ],
1188
            //         "01" => [
1189
            //             "name" => "JavaScript",
1190
            //             "requirement" => "essential",
1191
            //             "level" => "Moderately in Evidence"
1192
            //         ],
1193
            //         "02" => [
1194
            //             "name" => "CSS",
1195
            //             "requirement" => "essential",
1196
            //             "level" => "Advanced"
1197
            //         ],
1198
            //         "03" => [
1199
            //             "name" => "Laravel",
1200
            //             "requirement" => "essential",
1201
            //             "level" => "Intermediate"
1202
            //         ],
1203
            //         "04" => [
1204
            //             "name" => "Docker",
1205
            //             "requirement" => "asset",
1206
            //             "level" => "In Early Development"
1207
            //         ],
1208
            //         "05" => [
1209
            //             "name" => "Responsive Web Design",
1210
            //             "requirement" => "asset",
1211
            //             "level" => "In Early Development"
1212
            //         ],
1213
            //         "06" => [
1214
            //             "name" => "Adobe XD",
1215
            //             "requirement" => "asset",
1216
            //             "level" => "In Early Development"
1217
            //         ]
1218
            //     ]
1219
            // ],
1220
            "skills" => Skill::all(),
1221
        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
1222
    }
1223
1224
    /**
1225
     * Show the Application Preview for the application for the specified job.
1226
     *
1227
     * @param  \App\Models\JobPoster  $jobPoster
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
1228
     * @return \Illuminate\Http\Response
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
1229
     */
1230
    public function preview(JobPoster $jobPoster) {
1231
        $applicant = Auth::user()->applicant;
0 ignored issues
show
Bug introduced by
Accessing applicant on the interface Illuminate\Contracts\Auth\Authenticatable suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
1232
        $application = $this->getApplicationFromJob($jobPoster);
1233
1234
        return view('applicant/application_post_05', [
1 ignored issue
show
Bug Best Practice introduced by
The expression return view('applicant/a...p\Models\Skill::all())) returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
1235
            "applicant" => $applicant,
1236
            "form_submit_action" => route('job.application.submit', $jobPoster),
0 ignored issues
show
Bug introduced by
$jobPoster of type App\Models\JobPoster is incompatible with the type array expected by parameter $parameters of route(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

1236
            "form_submit_action" => route('job.application.submit', /** @scrutinizer ignore-type */ $jobPoster),
Loading history...
1237
            "application" => [
1238
                "id" => "00",
1239
                "title" => "Apply Now",
1240
                "step" => "5",
1241
                "job_context_copy" => "You are applying for:",
1242
1243
                "skills_section" => [
1244
                    "essential_title" => "Need to Have",
1245
                    "asset_title" => "Nice to Have",
1246
                    "add_button_label" => "Add Skill",
1247
                    "null_copy" => "You don't currently have any skills on your profile! Use the button above to add a skill."
1248
                ],
1249
1250
                "modals" => [
1251
                    "00" => [
1252
                        "type" => "createReference",
1253
                        "title" => "Create a New Reference",
1254
                        "content" => [
1255
                            "00" => "By submitting a reference you agree to having first asked their permission to provide their information. Please note that all information provided within a reference might be sent to said reference during a hiring process."
1256
                        ],
1257
                        "id" => "createReference",
1258
                        "action_01" => "Cancel",
1259
                        "action_02" => "Save"
1260
                    ],
1261
                    "01" => [
1262
                        "type" => "createSample",
1263
                        "title" => "Create a New Work Sample",
1264
                        "content" => [
1265
                        ],
1266
                        "id" => "createSample",
1267
                        "action_01" => "Cancel",
1268
                        "action_02" => "Save"
1269
                    ]
1270
                ],
1271
                "question_title" => "My Fit",
1272
                "save_quit_button_label" => "Save & Quit",
1273
                "save_continue_button_label" => "Save & Continue",
1274
                "essential_title" => "Skills You Need to Have",
1275
                "asset_title" => "Skills That Are Nice to Have",
1276
                "essential_context" => "This text is intended to explain the difference between essential and asset criteria while providing context for micro-references and work samples.",
1277
                "asset_context" => "This text is intended to explain the difference between essential and asset criteria while providing context for micro-references and work samples.",
1278
                "essential_start_button_title" => "Scroll to begin filling out the skills you need to have.",
1279
                "asset_start_button_title" => "Scroll to begin filling out the skills that are nice to have.",
1280
                "skills_start_button_label" => "Get Started",
1281
                "essential_sidebar_label" => "Skills Checklist",
1282
                "asset_sidebar_label" => "Skills Checklist",
1283
                "sidebar_item_title" => "Scroll to this skill.",
1284
                "skill_ui" => [
1285
                    "declaration_title" => "Required Information",
1286
                    "declaration_level_help_label" => "Unsure of your level?",
1287
                    "declaration_expertise_title" => "My Level of Expertise",
1288
                    "declaration_expertise" => [
1289
                        "Beginner",
1290
                        "Intermediate",
1291
                        "Expert",
1292
                        "Master"
1293
                    ],
1294
                    "declaration_experience_title" => "My Years of Experience",
1295
                    "declaration_experience" => [
1296
                        "1 of Less",
1297
                        "2 - 3",
1298
                        "4 - 5",
1299
                        "6 - 7",
1300
                        "8 or More"
1301
                    ],
1302
                    "declaration_knowledge_label" => "My Knowledge & Experience",
1303
                    "reference" => [
1304
                        "add_title" => "Add an optional reference.",
1305
                        "add_context" => "Appoint someone who can vouch for your ability in this skill."
1306
                    ],
1307
                    "sample" => [
1308
                        "add_title" => "Add an optional work sample.",
1309
                        "add_context" => "Provide a link to a sample of your work that showcases this skill."
1310
                    ],
1311
                    "save_button_label" => "Save",
1312
                    "delete_button_label" => "Remove"
1313
                ]
1314
            ],
1315
            "user" => [
1316
                "name" => "Jason Greene",
1317
                "photo" => false,
1318
                "skills" => [
1319
                    "00" => [
1320
                        "name" => "HTML",
1321
                        "status" => "Claimed",
1322
                        "level" => "beginner",
1323
                        "knowledge" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ut dolor tincidunt, malesuada enim vel, ullamcorper velit. Donec sit amet commodo libero. Curabitur gravida consectetur dolor, eu vulputate ligula aliquam in. Praesent tempus lectus et mauris placerat, nec congue lectus placerat.",
1324
                        "references" => [
1325
                            "00" => "Mark Hamill"
1326
                        ],
1327
                        "samples" => [
1328
                            "00" => "My Website"
1329
                        ]
1330
                    ],
1331
                    "01" => [
1332
                        "name" => "CSS",
1333
                        "status" => "Claimed",
1334
                        "level" => "advanced",
1335
                        "knowledge" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ut dolor tincidunt, malesuada enim vel, ullamcorper velit. Donec sit amet commodo libero. Curabitur gravida consectetur dolor, eu vulputate ligula aliquam in. Praesent tempus lectus et mauris placerat, nec congue lectus placerat.",
1336
                        "references" => [
1337
                            "00" => "Mark Hamill"
1338
                        ],
1339
                        "samples" => [
1340
                            "00" => "My Website"
1341
                        ]
1342
                    ],
1343
                    "02" => [
1344
                        "name" => "UX Research",
1345
                        "status" => "Claimed",
1346
                        "level" => "Moderately in Evidence",
1347
                        "knowledge" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ut dolor tincidunt, malesuada enim vel, ullamcorper velit. Donec sit amet commodo libero. Curabitur gravida consectetur dolor, eu vulputate ligula aliquam in. Praesent tempus lectus et mauris placerat, nec congue lectus placerat.",
1348
                        "references" => [],
1349
                        "samples" => []
1350
                    ]
1351
                ],
1352
                "references" => [
1353
                    "00" => [
1354
                        "name" => "Mark Hamill"
1355
                    ],
1356
                    "01" => [
1357
                        "name" => "Jesse Markham"
1358
                    ],
1359
                    "02" => [
1360
                        "name" => "Lucy Ladderfield"
1361
                    ],
1362
                    "03" => [
1363
                        "name" => "Cameron Trovsky"
1364
                    ]
1365
                ],
1366
                "samples" => [
1367
                    "00" => [
1368
                        "name" => "My Website",
1369
                        "type" => "Website",
1370
                        "date_created" => "2018-01-01",
1371
                        "link" => "https://google.com",
1372
                        "description" => "Lorem Ipsum",
1373
                        "skills" => [
1374
                            "00" => "HTML",
1375
                            "01" => "CSS"
1376
                        ]
1377
                    ]
1378
                ]
1379
            ],
1380
            "job_application" => $application,
1381
            "job" => $jobPoster,
1382
            // "job" => [
1383
            //     "link" => "/browse/jobs/00/",
1384
            //     "title" => "Front-end Developer",
1385
            //     "department" => "Treasury Board of Canada Secretariat",
1386
            //     "city" => "Ottawa",
1387
            //     "province" => "Ontario",
1388
            //     "salary" => "80,000 - 120,000",
1389
            //     "duration" => "1 Year",
1390
            //     "remote" => "Allowed",
1391
            //     "telework" => "Allowed",
1392
            //     "time_flexibility" => "Allowed",
1393
            //     "days_remaining" => "12",
1394
            //     "applicants" => "2",
1395
            //     "reference_id" => "14234",
1396
            //     "start" => "January 3rd, 2019",
1397
            //     "language" => "English Essential",
1398
            //     "security" => "Top Secret",
1399
            //     "classification" => "CS3",
1400
            //     "impact" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat. Sed quis laoreet tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer fringilla at ligula id porttitor. Nullam ac viverra velit, et rhoncus tellus. Praesent in lacus magna. Duis ut vulputate ipsum. In ut ornare elit. Donec id massa felis. Nam at ullamcorper risus. Vestibulum vitae aliquet ex, et ornare libero. Pellentesque sit amet vehicula neque. Donec auctor a erat posuere vehicula.",
1401
            //     "work" => [
1402
            //         "00" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat.",
1403
            //         "01" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat.",
1404
            //         "02" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat."
1405
            //     ],
1406
            //     "criteria" => [
1407
            //         "essential" => [
1408
            //             "00" => "Criteria 01",
1409
            //             "01" => "Criteria 02",
1410
            //             "02" => "Criteria 03"
1411
            //         ],
1412
            //         "asset" => [
1413
            //             "00" => "Criteria 01",
1414
            //             "01" => "Criteria 02",
1415
            //             "02" => "Criteria 03"
1416
            //         ]
1417
            //     ],
1418
            //     "extras" => [
1419
            //         "00" => [
1420
            //             "title" => "What You Need for Security Clearance",
1421
            //             "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
1422
            //         ],
1423
            //         "01" => [
1424
            //             "title" => "The Application Process",
1425
            //             "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
1426
            //         ],
1427
            //         "02" => [
1428
            //             "title" => "Other Paperwork & Preparation",
1429
            //             "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
1430
            //         ]
1431
            //     ],
1432
            //     "questions" => [
1433
            //         "00" => [
1434
            //             "value" => "Why are you interested in this job?",
1435
            //             "description" => "We want to know why you are interested in this job instead of other similar ones. This information will be used to help inform a decision to choose between fully qualified candidates at the end of the selection process.",
1436
            //             "input_name" => "jobPostQuestion0",
1437
            //             "answer_label" => "Your Answer",
1438
            //             "answer" => null
1439
            //         ],
1440
            //         "01" => [
1441
            //             "value" => "Why are you the right person for this job?",
1442
            //             "description" => "Tell us what makes you unique. Why should you stand out from other candidates. This information will be used to help inform a decision to choose between fully qualified candidates at the end of the selection process.",
1443
            //             "input_name" => "jobPostQuestion1",
1444
            //             "answer_label" => "Your Answer",
1445
            //             "answer" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
1446
            //         ]
1447
            //     ],
1448
            //     "skills" => [
1449
            //         "00" => [
1450
            //             "name" => "HTML",
1451
            //             "requirement" => "essential",
1452
            //             "level" => "Intermediate"
1453
            //         ],
1454
            //         "01" => [
1455
            //             "name" => "JavaScript",
1456
            //             "requirement" => "essential",
1457
            //             "level" => "Moderately in Evidence"
1458
            //         ],
1459
            //         "02" => [
1460
            //             "name" => "CSS",
1461
            //             "requirement" => "essential",
1462
            //             "level" => "Advanced"
1463
            //         ],
1464
            //         "03" => [
1465
            //             "name" => "Laravel",
1466
            //             "requirement" => "essential",
1467
            //             "level" => "Intermediate"
1468
            //         ],
1469
            //         "04" => [
1470
            //             "name" => "Docker",
1471
            //             "requirement" => "asset",
1472
            //             "level" => "In Early Development"
1473
            //         ],
1474
            //         "05" => [
1475
            //             "name" => "Responsive Web Design",
1476
            //             "requirement" => "asset",
1477
            //             "level" => "In Early Development"
1478
            //         ],
1479
            //         "06" => [
1480
            //             "name" => "Adobe XD",
1481
            //             "requirement" => "asset",
1482
            //             "level" => "In Early Development"
1483
            //         ]
1484
            //     ]
1485
            // ],
1486
            "skills" => Skill::all(),
1487
        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
1488
    }
1489
1490
    /**
1491
     * Update the Application Basics in storage for the specified job.
1492
     *
1493
     * @param  \Illuminate\Http\Request  $request
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
1494
     * @param  \App\Models\JobPoster  $jobPoster
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 4 spaces after parameter type; 2 found
Loading history...
1495
     * @return \Illuminate\Http\Response
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
1496
     */
1497
    public function update_basics(Request $request, JobPoster $jobPoster)
0 ignored issues
show
Coding Style introduced by
Public method name "ApplicationByJobController::update_basics" is not in camel caps format
Loading history...
1498
    {
1499
        $input = $request->input();
1500
        $applicant = Auth::user()->applicant;
0 ignored issues
show
Bug introduced by
Accessing applicant on the interface Illuminate\Contracts\Auth\Authenticatable suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
Unused Code introduced by
The assignment to $applicant is dead and can be removed.
Loading history...
1501
        $application = $this->getApplicationFromJob($jobPoster);
1502
1503
        $application->fill([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
1504
            'citizenship_declaration_id' => $input['citizenship_declaration_id'],
1505
            'veteran_status_id' => $input['veteran_status_id'],
1506
            'preferred_language_id' => $input['preferred_language_id'],
1507
        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
1508
        $application->save();
1509
1510
        $questions = $jobPoster->job_poster_questions;
1511
        foreach($questions as $question) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
1512
            $answer = null;
1513
            if (isset($input['questions']) &&
1514
                isset($input['questions'][$question->id])) {
0 ignored issues
show
Coding Style introduced by
Each line in a multi-line IF statement must begin with a boolean operator
Loading history...
Coding Style introduced by
Closing parenthesis of a multi-line IF statement must be on a new line
Loading history...
1515
                $answer = $input['questions'][$question->id];
1516
            }
1517
            $answerObj = $application->job_application_answers
1518
                ->firstWhere('job_poster_question_id', $question->id);
1519
            if ($answerObj == null) {
1520
                $answerObj = new JobApplicationAnswer();
1521
                $answerObj->job_poster_question_id = $question->id;
1522
                $answerObj->job_application_id = $application->id;
1523
            }
1524
            $answerObj->answer = $answer;
1525
            $answerObj->save();
1526
        }
1527
1528
        return redirect( route('job.application.edit.2', $jobPoster));
1 ignored issue
show
Bug introduced by
$jobPoster of type App\Models\JobPoster is incompatible with the type array expected by parameter $parameters of route(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

1528
        return redirect( route('job.application.edit.2', /** @scrutinizer ignore-type */ $jobPoster));
Loading history...
Bug Best Practice introduced by
The expression return redirect(route('j...n.edit.2', $jobPoster)) returns the type Illuminate\Http\RedirectResponse which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
1529
    }
1530
1531
    /**
1532
     * Update the Application Basics in storage for the specified job.
1533
     *
1534
     * @param  \Illuminate\Http\Request  $request
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
1535
     * @param  \App\Models\JobPoster  $jobPoster
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 4 spaces after parameter type; 2 found
Loading history...
1536
     * @return \Illuminate\Http\Response
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
1537
     */
1538
    public function update_experience(Request $request, JobPoster $jobPoster)
0 ignored issues
show
Coding Style introduced by
Public method name "ApplicationByJobController::update_experience" is not in camel caps format
Loading history...
1539
    {
1540
        $input = $request->input();
1541
        $applicant = Auth::user()->applicant;
0 ignored issues
show
Bug introduced by
Accessing applicant on the interface Illuminate\Contracts\Auth\Authenticatable suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
1542
        $application = $this->getApplicationFromJob($jobPoster);
0 ignored issues
show
Unused Code introduced by
The assignment to $application is dead and can be removed.
Loading history...
1543
1544
        //TODO: save stuff to application
1545
1546
        //TODO: Note from Tristan: I did test this function, and it works as I expect,
1547
        //TODO:     saving new/updated degrees, courses and work experiences
1548
        //TODO:     to the profile.
1549
        $degrees = $input['degrees'];
1550
1551
        //Save new degrees
1552
        if (isset($degrees['new'])) {
1553
            foreach($degrees['new'] as $degreeInput) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
1554
                $degree = new Degree();
1555
                $degree->applicant_id = $applicant->id;
1556
                $degree->fill([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
1557
                    'degree_type_id' => $degreeInput['degree_type_id'],
1558
                    'area_of_study' => $degreeInput['area_of_study'],
1559
                    'institution' => $degreeInput['institution'],
1560
                    'thesis' => $degreeInput['thesis'],
1561
                    'start_date' => $degreeInput['start_date'],
1562
                    'end_date' => $degreeInput['end_date']
1563
                ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
1564
                $degree->save();
1565
            }
1566
        }
1567
1568
        //Update old degrees
1569
        if (isset($degrees['old'])) {
1570
            foreach($degrees['old'] as $id=>$degreeInput) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
1571
                //Ensure this degree belongs to this applicant
1572
                $degree = $applicant->degrees->firstWhere('id', $id);
1573
                if ($degree != null) {
1574
                    $degree->fill([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
1575
                        'degree_type_id' => $degreeInput['degree_type_id'],
1576
                        'area_of_study' => $degreeInput['area_of_study'],
1577
                        'institution' => $degreeInput['institution'],
1578
                        'thesis' => $degreeInput['thesis'],
1579
                        'start_date' => $degreeInput['start_date'],
1580
                        'end_date' => $degreeInput['end_date']
1581
                    ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
1582
                    $degree->save();
1583
                } else {
1584
                    Debugbar::warning('Applicant '.$applicant->id.' attempted to update degree with invalid id '.$id);
1585
                }
1586
            }
1587
        }
1588
1589
        $courses = $input['courses'];
1590
1591
        //Save new courses
1592
        if (isset($courses['new'])) {
1593
            foreach($courses['new'] as $courseInput) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
1594
                $course = new Course();
1595
                $course->applicant_id = $applicant->id;
1596
                $course->fill([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
1597
                    'name' => $courseInput['name'],
1598
                    'institution' => $courseInput['institution'],
1599
                    'course_status_id' => $courseInput['course_status_id'],
1600
                    'start_date' => $courseInput['start_date'],
1601
                    'end_date' => $courseInput['end_date']
1602
                ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
1603
                $course->save();
1604
            }
1605
        }
1606
1607
        //Update old courses
1608
        if (isset($courses['old'])) {
1609
            foreach($courses['old'] as $id=>$courseInput) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
1610
                //Ensure this course belongs to this applicant
1611
                $course = $applicant->courses->firstWhere('id', $id);
1612
                if ($course != null) {
1613
                    $course->fill([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
1614
                        'name' => $courseInput['name'],
1615
                        'institution' => $courseInput['institution'],
1616
                        'course_status_id' => $courseInput['course_status_id'],
1617
                        'start_date' => $courseInput['start_date'],
1618
                        'end_date' => $courseInput['end_date']
1619
                    ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
1620
                    $course->save();
1621
                } else {
1622
                    Debugbar::warning('Applicant '.$applicant->id.' attempted to update course with invalid id '.$id);
1623
                }
1624
            }
1625
        }
1626
1627
        $work_experiences = $input['work_experiences'] ;
1628
1629
        //Save new work_experiences
1630
        if (isset($work_experiences['new'])) {
1631
            foreach($work_experiences['new'] as $workExperienceInput) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
1632
                $workExperience = new WorkExperience();
1633
                $workExperience->applicant_id = $applicant->id;
1634
                $workExperience->fill([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
1635
                    'role' => $workExperienceInput['role'],
1636
                    'company' => $workExperienceInput['company'],
1637
                    'description' => $workExperienceInput['description'],
1638
                    'start_date' => $workExperienceInput['start_date'],
1639
                    'end_date' => $workExperienceInput['end_date']
1640
                ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
1641
                $workExperience->save();
1642
            }
1643
        }
1644
1645
        //Update old work_experiences
1646
        if (isset($work_experiences['old'])) {
1647
            foreach($work_experiences['old'] as $id=>$workExperienceInput) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
1648
                //Ensure this work_experience belongs to this applicant
1649
                $workExperience = $applicant->work_experiences->firstWhere('id', $id);
1650
                if ($workExperience != null) {
1651
                    $workExperience->fill([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
1652
                        'role' => $workExperienceInput['role'],
1653
                        'company' => $workExperienceInput['company'],
1654
                        'description' => $workExperienceInput['description'],
1655
                        'start_date' => $workExperienceInput['start_date'],
1656
                        'end_date' => $workExperienceInput['end_date']
1657
                    ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
1658
                    $workExperience->save();
1659
                } else {
1660
                    Debugbar::warning('Applicant '.$applicant->id.' attempted to update work_experience with invalid id '.$id);
1661
                }
1662
            }
1663
        }
1664
1665
        return redirect( route('job.application.edit.3', $jobPoster));
1 ignored issue
show
Bug Best Practice introduced by
The expression return redirect(route('j...n.edit.3', $jobPoster)) returns the type Illuminate\Http\RedirectResponse which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
Bug introduced by
$jobPoster of type App\Models\JobPoster is incompatible with the type array expected by parameter $parameters of route(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

1665
        return redirect( route('job.application.edit.3', /** @scrutinizer ignore-type */ $jobPoster));
Loading history...
1666
    }
1667
1668
    /**
1669
     * Update the Application Essential Skills in storage for the specified job.
1670
     *
1671
     * @param  \Illuminate\Http\Request  $request
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
1672
     * @param  \App\Models\JobPoster  $jobPoster
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 4 spaces after parameter type; 2 found
Loading history...
1673
     * @return \Illuminate\Http\Response
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
1674
     */
1675
    public function update_essential_skills(Request $request, JobPoster $jobPoster)
0 ignored issues
show
Coding Style introduced by
Public method name "ApplicationByJobController::update_essential_skills" is not in camel caps format
Loading history...
1676
    {
1677
        $input = $request->input();
1678
        $applicant = Auth::user()->applicant;
0 ignored issues
show
Bug introduced by
Accessing applicant on the interface Illuminate\Contracts\Auth\Authenticatable suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
1679
        $application = $this->getApplicationFromJob($jobPoster);
0 ignored issues
show
Unused Code introduced by
The assignment to $application is dead and can be removed.
Loading history...
1680
1681
        //TODO: save stuff to application
1682
1683
        //TODO: Note from Tristan: I haven't tested this. This was copied from the SkillsController.
1684
        //TODO: But for now, if we're just updating the Applicant's Profile through this page,
1685
        //TODO: then this same code, or something very close, should work.
1686
1687
        $skillDeclarations = $input['skill_declarations'];
1688
        $claimedStatusId = SkillStatus::where('name', 'claimed')->firstOrFail()->id;
1689
1690
        //Save new skill declarartions
1691
        if (isset($skillDeclarations['new'])) {
1692
            foreach($skillDeclarations['new'] as $skillType => $typeInput) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
1693
                foreach($typeInput as $skillDeclarationInput) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
1694
                    $skillDeclaration = new SkillDeclaration();
1695
                    $skillDeclaration->applicant_id = $applicant->id;
1696
                    $skillDeclaration->skill_id = $skillDeclarationInput['skill_id'];
1697
                    $skillDeclaration->skill_status_id = $claimedStatusId;
1698
                    $skillDeclaration->fill([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
1699
                        'description' => $skillDeclarationInput['description'],
1700
                        'skill_level_id' => $skillDeclarationInput['skill_level_id'],
1701
                    ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
1702
                    $skillDeclaration->save();
1703
1704
                    $referenceIds = $this->getRelativeIds($skillDeclarationInput, 'references');
1705
                    $skillDeclaration->references()->sync($referenceIds);
1706
1707
                    $sampleIds = $this->getRelativeIds($skillDeclarationInput, 'samples');
1708
                    $skillDeclaration->work_samples()->sync($sampleIds);
1709
                }
1710
            }
1711
        }
1712
1713
        //Update old declarations
1714
        if (isset($skillDeclarations['old'])) {
1715
            foreach($skillDeclarations['old'] as $skillType => $typeInput) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
1716
                foreach($typeInput as $id=>$skillDeclarationInput) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
1717
                    //Ensure this declaration belongs to this applicant
1718
                    $skillDeclaration = $applicant->skill_declarations->firstWhere('id', $id);
1719
                    if ($skillDeclaration != null) {
1720
                        //skill_id and skill_status cannot be changed
1721
                        $skillDeclaration->fill([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
1722
                            'description' => $skillDeclarationInput['description'],
1723
                            'skill_level_id' => $skillDeclarationInput['skill_level_id'],
1724
                        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
1725
                        $skillDeclaration->save();
1726
1727
                        $referenceIds = $this->getRelativeIds($skillDeclarationInput, 'references');
1728
                        $skillDeclaration->references()->sync($referenceIds);
1729
1730
                        $sampleIds = $this->getRelativeIds($skillDeclarationInput, 'samples');
1731
                        $skillDeclaration->work_samples()->sync($sampleIds);
1732
                    } else {
1733
                        Debugbar::warning('Applicant '.$applicant->id.' attempted to update skill declaration with invalid id '.$id);
1734
                    }
1735
                }
1736
            }
1737
        }
1738
1739
        return redirect( route('job.application.edit.4', $jobPoster));
1 ignored issue
show
Bug Best Practice introduced by
The expression return redirect(route('j...n.edit.4', $jobPoster)) returns the type Illuminate\Http\RedirectResponse which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
Bug introduced by
$jobPoster of type App\Models\JobPoster is incompatible with the type array expected by parameter $parameters of route(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

1739
        return redirect( route('job.application.edit.4', /** @scrutinizer ignore-type */ $jobPoster));
Loading history...
1740
    }
1741
1742
    /**
1743
     * Update the Application Asset Skills in storage for the specified job.
1744
     *
1745
     * @param  \Illuminate\Http\Request  $request
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
1746
     * @param  \App\Models\JobPoster  $jobPoster
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 4 spaces after parameter type; 2 found
Loading history...
1747
     * @return \Illuminate\Http\Response
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
1748
     */
1749
    public function update_asset_skills(Request $request, JobPoster $jobPoster)
0 ignored issues
show
Coding Style introduced by
Public method name "ApplicationByJobController::update_asset_skills" is not in camel caps format
Loading history...
1750
    {
1751
        $input = $request->input();
1752
        $applicant = Auth::user()->applicant;
0 ignored issues
show
Bug introduced by
Accessing applicant on the interface Illuminate\Contracts\Auth\Authenticatable suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
1753
        $application = $this->getApplicationFromJob($jobPoster);
0 ignored issues
show
Unused Code introduced by
The assignment to $application is dead and can be removed.
Loading history...
1754
1755
        //TODO: save stuff to application
1756
1757
        //TODO: Note from Tristan: I haven't tested this. This was copied from the SkillsController.
1758
        //TODO: But for now, if we're just updating the Applicant's Profile through this page,
1759
        //TODO: then this same code, or something very close, should work.
1760
1761
        $skillDeclarations = $input['skill_declarations'];
1762
        $claimedStatusId = SkillStatus::where('name', 'claimed')->firstOrFail()->id;
1763
1764
        //Save new skill declarartions
1765
        if (isset($skillDeclarations['new'])) {
1766
            foreach($skillDeclarations['new'] as $skillType => $typeInput) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
1767
                foreach($typeInput as $skillDeclarationInput) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
1768
                    $skillDeclaration = new SkillDeclaration();
1769
                    $skillDeclaration->applicant_id = $applicant->id;
1770
                    $skillDeclaration->skill_id = $skillDeclarationInput['skill_id'];
1771
                    $skillDeclaration->skill_status_id = $claimedStatusId;
1772
                    $skillDeclaration->fill([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
1773
                        'description' => $skillDeclarationInput['description'],
1774
                        'skill_level_id' => $skillDeclarationInput['skill_level_id'],
1775
                    ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
1776
                    $skillDeclaration->save();
1777
1778
                    $referenceIds = $this->getRelativeIds($skillDeclarationInput, 'references');
1779
                    $skillDeclaration->references()->sync($referenceIds);
1780
1781
                    $sampleIds = $this->getRelativeIds($skillDeclarationInput, 'samples');
1782
                    $skillDeclaration->work_samples()->sync($sampleIds);
1783
                }
1784
            }
1785
        }
1786
1787
        //Update old declarations
1788
        if (isset($skillDeclarations['old'])) {
1789
            foreach($skillDeclarations['old'] as $skillType => $typeInput) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
1790
                foreach($typeInput as $id=>$skillDeclarationInput) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
1791
                    //Ensure this declaration belongs to this applicant
1792
                    $skillDeclaration = $applicant->skill_declarations->firstWhere('id', $id);
1793
                    if ($skillDeclaration != null) {
1794
                        //skill_id and skill_status cannot be changed
1795
                        $skillDeclaration->fill([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
1796
                            'description' => $skillDeclarationInput['description'],
1797
                            'skill_level_id' => $skillDeclarationInput['skill_level_id'],
1798
                        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
1799
                        $skillDeclaration->save();
1800
1801
                        $referenceIds = $this->getRelativeIds($skillDeclarationInput, 'references');
1802
                        $skillDeclaration->references()->sync($referenceIds);
1803
1804
                        $sampleIds = $this->getRelativeIds($skillDeclarationInput, 'samples');
1805
                        $skillDeclaration->work_samples()->sync($sampleIds);
1806
                    } else {
1807
                        Debugbar::warning('Applicant '.$applicant->id.' attempted to update skill declaration with invalid id '.$id);
1808
                    }
1809
                }
1810
            }
1811
        }
1812
1813
        return redirect( route('job.application.edit.5', $jobPoster));
1 ignored issue
show
Bug Best Practice introduced by
The expression return redirect(route('j...n.edit.5', $jobPoster)) returns the type Illuminate\Http\RedirectResponse which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
Bug introduced by
$jobPoster of type App\Models\JobPoster is incompatible with the type array expected by parameter $parameters of route(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

1813
        return redirect( route('job.application.edit.5', /** @scrutinizer ignore-type */ $jobPoster));
Loading history...
1814
    }
1815
1816
    /**
1817
     * Submit the Application for the specified job.
1818
     *
1819
     * @param  \Illuminate\Http\Request  $request
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
1820
     * @param  \App\Models\JobPoster  $jobPoster
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 4 spaces after parameter type; 2 found
Loading history...
1821
     * @return \Illuminate\Http\Response
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
1822
     */
1823
    public function submit(Request $request, JobPoster $jobPoster)
1824
    {
1825
        $input = $request->input();
0 ignored issues
show
Unused Code introduced by
The assignment to $input is dead and can be removed.
Loading history...
1826
        $applicant = Auth::user()->applicant;
0 ignored issues
show
Bug introduced by
Accessing applicant on the interface Illuminate\Contracts\Auth\Authenticatable suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
Unused Code introduced by
The assignment to $applicant is dead and can be removed.
Loading history...
1827
        $application = $this->getApplicationFromJob($jobPoster);
1828
1829
        //TODO: Save any input (vows, etc)
1830
1831
        //TODO: Check that application is valid and complete
1832
1833
        //Change status to 'submitted'
1834
        $application->application_status_id = ApplicationStatus::where('name', 'submitted')->firstOrFail()->id;
1835
1836
        //TODO: where should we redirect after submitting?
1837
        return redirect( route('applications.index', $jobPoster));
1 ignored issue
show
Bug Best Practice introduced by
The expression return redirect(route('a...ns.index', $jobPoster)) returns the type Illuminate\Http\RedirectResponse which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
Bug introduced by
$jobPoster of type App\Models\JobPoster is incompatible with the type array expected by parameter $parameters of route(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

1837
        return redirect( route('applications.index', /** @scrutinizer ignore-type */ $jobPoster));
Loading history...
1838
    }
1839
}
1840