@@ -16,9 +16,9 @@ discard block |
||
16 | 16 | * @param \App\Models\Degree $degree |
17 | 17 | * @return mixed |
18 | 18 | */ |
19 | - public function view(User $user, Degree $degree) |
|
19 | + public function view (User $user, Degree $degree) |
|
20 | 20 | { |
21 | - return $user->isApplicant() && $degree->applicant->user->is($user); |
|
21 | + return $user->isApplicant () && $degree->applicant->user->is ($user); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | * @param \App\Models\User $user |
28 | 28 | * @return mixed |
29 | 29 | */ |
30 | - public function create(User $user) |
|
30 | + public function create (User $user) |
|
31 | 31 | { |
32 | - return $user->isApplicant(); |
|
32 | + return $user->isApplicant (); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | * @param \App\Models\Degree $degree |
40 | 40 | * @return mixed |
41 | 41 | */ |
42 | - public function update(User $user, Degree $degree) |
|
42 | + public function update (User $user, Degree $degree) |
|
43 | 43 | { |
44 | - return $user->isApplicant() && $degree->applicant->user->is($user); |
|
44 | + return $user->isApplicant () && $degree->applicant->user->is ($user); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | * @param \App\Models\Degree $degree |
52 | 52 | * @return mixed |
53 | 53 | */ |
54 | - public function delete(User $user, Degree $degree) |
|
54 | + public function delete (User $user, Degree $degree) |
|
55 | 55 | { |
56 | - return $user->isApplicant() && $degree->applicant->user->is($user); |
|
56 | + return $user->isApplicant () && $degree->applicant->user->is ($user); |
|
57 | 57 | } |
58 | 58 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @param App\Models\Applicant $user |
19 | 19 | * @return void |
20 | 20 | */ |
21 | - public function __construct(Applicant $applicant, $skill_declaration_id = null) |
|
21 | + public function __construct (Applicant $applicant, $skill_declaration_id = null) |
|
22 | 22 | { |
23 | 23 | $this->applicant = $applicant; |
24 | 24 | $this->skill_declaration_id = $skill_declaration_id; |
@@ -31,16 +31,16 @@ discard block |
||
31 | 31 | * @param [type] $value [description] |
32 | 32 | * @return [type] [description] |
33 | 33 | */ |
34 | - public function passes($attribute, $value) |
|
34 | + public function passes ($attribute, $value) |
|
35 | 35 | { |
36 | - $prev_skills = $this->applicant->skill_declarations->where('skill_id', $value)->pluck('id'); |
|
36 | + $prev_skills = $this->applicant->skill_declarations->where ('skill_id', $value)->pluck ('id'); |
|
37 | 37 | |
38 | - return $prev_skills->isEmpty() || |
|
39 | - ($this->skill_declaration_id != null && $prev_skills->contains($this->skill_declaration_id)); |
|
38 | + return $prev_skills->isEmpty () || |
|
39 | + ($this->skill_declaration_id != null && $prev_skills->contains ($this->skill_declaration_id)); |
|
40 | 40 | } |
41 | 41 | |
42 | - public function message() |
|
42 | + public function message () |
|
43 | 43 | { |
44 | - return Lang::get('validation.user_skill_unique'); |
|
44 | + return Lang::get ('validation.user_skill_unique'); |
|
45 | 45 | } |
46 | 46 | } |
@@ -17,15 +17,15 @@ discard block |
||
17 | 17 | * |
18 | 18 | * @return \Illuminate\Http\Response |
19 | 19 | */ |
20 | - public function index() |
|
20 | + public function index () |
|
21 | 21 | { |
22 | - $applications = Auth::user()->applicant->job_applications; |
|
23 | - return view( |
|
22 | + $applications = Auth::user ()->applicant->job_applications; |
|
23 | + return view ( |
|
24 | 24 | 'applicant/application_index', |
25 | 25 | [ |
26 | - 'application_index' => Lang::get('applicant/application_index'), |
|
26 | + 'application_index' => Lang::get ('applicant/application_index'), |
|
27 | 27 | 'applications' => $applications, |
28 | - 'departments_template' => Lang::get('common/lookup/departments'), |
|
28 | + 'departments_template' => Lang::get ('common/lookup/departments'), |
|
29 | 29 | 'manager_profile_photo' => '/images/user.png', // TODO: get real photo. |
30 | 30 | ] |
31 | 31 | ); |
@@ -37,51 +37,50 @@ discard block |
||
37 | 37 | * @param \App\Models\JobApplication $application Incoming Application object. |
38 | 38 | * @return \Illuminate\Http\Response |
39 | 39 | */ |
40 | - public function show(JobApplication $application) |
|
40 | + public function show (JobApplication $application) |
|
41 | 41 | { |
42 | 42 | $criteria = [ |
43 | - 'essential' => $application->job_poster->criteria->filter(function ($value, $key) { |
|
43 | + 'essential' => $application->job_poster->criteria->filter (function ($value, $key) { |
|
44 | 44 | return $value->criteria_type->name == 'essential'; |
45 | 45 | }), |
46 | - 'asset' => $application->job_poster->criteria->filter(function ($value, $key) { |
|
46 | + 'asset' => $application->job_poster->criteria->filter (function ($value, $key) { |
|
47 | 47 | return $value->criteria_type->name == 'asset'; |
48 | 48 | }), |
49 | 49 | ]; |
50 | 50 | |
51 | 51 | // Display slightly different views on different portals. |
52 | - $view = WhichPortal::isManagerPortal() ? |
|
53 | - 'manager/application_post' : |
|
54 | - 'applicant/application_preview'; |
|
52 | + $view = WhichPortal::isManagerPortal () ? |
|
53 | + 'manager/application_post' : 'applicant/application_preview'; |
|
55 | 54 | |
56 | - if (WhichPortal::isManagerPortal()) { |
|
55 | + if (WhichPortal::isManagerPortal ()) { |
|
57 | 56 | // Load things required for review component. |
58 | - $application->load(['veteran_status', 'citizenship_declaration', 'application_review', 'applicant.user']); |
|
57 | + $application->load (['veteran_status', 'citizenship_declaration', 'application_review', 'applicant.user']); |
|
59 | 58 | } |
60 | 59 | |
61 | - return view( |
|
60 | + return view ( |
|
62 | 61 | $view, |
63 | 62 | [ |
64 | 63 | // Localized strings. |
65 | - 'post' => Lang::get('manager/application_post'), // Change text |
|
66 | - 'is_manager_view' => WhichPortal::isManagerPortal(), |
|
64 | + 'post' => Lang::get ('manager/application_post'), // Change text |
|
65 | + 'is_manager_view' => WhichPortal::isManagerPortal (), |
|
67 | 66 | // Application Template Data. |
68 | - 'application_template' => Lang::get('applicant/application_template'), |
|
67 | + 'application_template' => Lang::get ('applicant/application_template'), |
|
69 | 68 | 'application_preview' => true, |
70 | - 'preferred_language_template' => Lang::get('common/preferred_language'), |
|
71 | - 'citizenship_declaration_template' => Lang::get('common/citizenship_declaration'), |
|
72 | - 'veteran_status_template' => Lang::get('common/veteran_status'), |
|
69 | + 'preferred_language_template' => Lang::get ('common/preferred_language'), |
|
70 | + 'citizenship_declaration_template' => Lang::get ('common/citizenship_declaration'), |
|
71 | + 'veteran_status_template' => Lang::get ('common/veteran_status'), |
|
73 | 72 | // Job Data. |
74 | 73 | 'job' => $application->job_poster, |
75 | 74 | // Skills Data. |
76 | - 'skills' => Skill::all(), |
|
77 | - 'skill_template' => Lang::get('common/skills'), |
|
78 | - 'reference_template' => Lang::get('common/references'), |
|
79 | - 'sample_template' => Lang::get('common/work_samples'), |
|
75 | + 'skills' => Skill::all (), |
|
76 | + 'skill_template' => Lang::get ('common/skills'), |
|
77 | + 'reference_template' => Lang::get ('common/references'), |
|
78 | + 'sample_template' => Lang::get ('common/work_samples'), |
|
80 | 79 | 'criteria' => $criteria, |
81 | 80 | // Applicant Data. |
82 | 81 | 'applicant' => $application->applicant, |
83 | 82 | 'job_application' => $application, |
84 | - 'review_statuses' => ReviewStatus::all(), |
|
83 | + 'review_statuses' => ReviewStatus::all (), |
|
85 | 84 | ] |
86 | 85 | ); |
87 | 86 | } |
@@ -93,18 +92,18 @@ discard block |
||
93 | 92 | * @param \App\Models\JobApplication $application Incoming Application object. |
94 | 93 | * @return \Illuminate\Http\Response |
95 | 94 | */ |
96 | - public function destroy(Request $request, JobApplication $application) |
|
95 | + public function destroy (Request $request, JobApplication $application) |
|
97 | 96 | { |
98 | - $this->authorize('delete', $application); |
|
97 | + $this->authorize ('delete', $application); |
|
99 | 98 | |
100 | - $application->delete(); |
|
99 | + $application->delete (); |
|
101 | 100 | |
102 | - if ($request->ajax()) { |
|
101 | + if ($request->ajax ()) { |
|
103 | 102 | return [ |
104 | 103 | 'message' => 'Application deleted' |
105 | 104 | ]; |
106 | 105 | } |
107 | 106 | |
108 | - return redirect()->back(); |
|
107 | + return redirect ()->back (); |
|
109 | 108 | } |
110 | 109 | } |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | * @param \Illuminate\Http\Request $request Incoming Request. |
18 | 18 | * @return \Illuminate\Http\RedirectResponse |
19 | 19 | */ |
20 | - public function editAuthenticated(Request $request) |
|
20 | + public function editAuthenticated (Request $request) |
|
21 | 21 | { |
22 | - $applicant = $request->user()->applicant; |
|
23 | - return redirect(route('profile.work_samples.edit', $applicant)); |
|
22 | + $applicant = $request->user ()->applicant; |
|
23 | + return redirect (route ('profile.work_samples.edit', $applicant)); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -30,16 +30,16 @@ discard block |
||
30 | 30 | * @param \App\Models\Applicant $applicant Incoming Applicant object. |
31 | 31 | * @return \Illuminate\Http\Response |
32 | 32 | */ |
33 | - public function edit(Request $request, Applicant $applicant) |
|
33 | + public function edit (Request $request, Applicant $applicant) |
|
34 | 34 | { |
35 | - $applicant->load([ |
|
35 | + $applicant->load ([ |
|
36 | 36 | 'work_samples', |
37 | 37 | 'skill_declarations.skill', |
38 | 38 | ]); |
39 | 39 | |
40 | - return view('applicant/profile_05_portfolio', [ |
|
40 | + return view ('applicant/profile_05_portfolio', [ |
|
41 | 41 | 'applicant' => $applicant, |
42 | - 'profile' => Lang::get('applicant/profile_work_samples'), |
|
42 | + 'profile' => Lang::get ('applicant/profile_work_samples'), |
|
43 | 43 | ]); |
44 | 44 | } |
45 | 45 | |
@@ -50,33 +50,33 @@ discard block |
||
50 | 50 | * @param \App\Models\WorkSample|null $workSample Incoming optional Work Sample. |
51 | 51 | * @return \Illuminate\Http\Response |
52 | 52 | */ |
53 | - public function update(Request $request, ?WorkSample $workSample = null) |
|
53 | + public function update (Request $request, ?WorkSample $workSample = null) |
|
54 | 54 | { |
55 | - $validator = new UpdateWorkSampleValidator(); |
|
56 | - $validator->validate($request->input()); |
|
55 | + $validator = new UpdateWorkSampleValidator (); |
|
56 | + $validator->validate ($request->input ()); |
|
57 | 57 | |
58 | 58 | if ($workSample === null) { |
59 | - $workSample = new WorkSample(); |
|
60 | - $workSample->applicant_id = $request->user()->applicant->id; |
|
59 | + $workSample = new WorkSample (); |
|
60 | + $workSample->applicant_id = $request->user ()->applicant->id; |
|
61 | 61 | } |
62 | - $workSample->fill([ |
|
63 | - 'name' => $request->input('name'), |
|
64 | - 'file_type_id' => $request->input('file_type_id'), |
|
65 | - 'url' => $request->input('url'), |
|
66 | - 'description' => $request->input('description'), |
|
62 | + $workSample->fill ([ |
|
63 | + 'name' => $request->input ('name'), |
|
64 | + 'file_type_id' => $request->input ('file_type_id'), |
|
65 | + 'url' => $request->input ('url'), |
|
66 | + 'description' => $request->input ('description'), |
|
67 | 67 | ]); |
68 | - $workSample->save(); |
|
68 | + $workSample->save (); |
|
69 | 69 | |
70 | 70 | // Attach relatives. |
71 | - $skillIds = $this->getRelativeIds($request->input(), 'skills'); |
|
72 | - $workSample->skill_declarations()->sync($skillIds); |
|
71 | + $skillIds = $this->getRelativeIds ($request->input (), 'skills'); |
|
72 | + $workSample->skill_declarations ()->sync ($skillIds); |
|
73 | 73 | |
74 | 74 | // If an ajax request, return the new object. |
75 | - if ($request->ajax()) { |
|
76 | - $workSample->load('file_type'); |
|
77 | - return $workSample->toJson(); |
|
75 | + if ($request->ajax ()) { |
|
76 | + $workSample->load ('file_type'); |
|
77 | + return $workSample->toJson (); |
|
78 | 78 | } else { |
79 | - return redirect()->back(); |
|
79 | + return redirect ()->back (); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
@@ -87,18 +87,18 @@ discard block |
||
87 | 87 | * @param \App\Models\WorkSample $workSample Incoming Work Sample. |
88 | 88 | * @return \Illuminate\Http\Response |
89 | 89 | */ |
90 | - public function destroy(Request $request, WorkSample $workSample) |
|
90 | + public function destroy (Request $request, WorkSample $workSample) |
|
91 | 91 | { |
92 | - $this->authorize('delete', $workSample); |
|
92 | + $this->authorize ('delete', $workSample); |
|
93 | 93 | |
94 | - $workSample->delete(); |
|
94 | + $workSample->delete (); |
|
95 | 95 | |
96 | - if ($request->ajax()) { |
|
96 | + if ($request->ajax ()) { |
|
97 | 97 | return [ |
98 | 98 | 'message' => 'Work sample deleted' |
99 | 99 | ]; |
100 | 100 | } |
101 | 101 | |
102 | - return redirect()->back(); |
|
102 | + return redirect ()->back (); |
|
103 | 103 | } |
104 | 104 | } |
@@ -32,24 +32,24 @@ discard block |
||
32 | 32 | * @param \App\Models\JobPoster $jobPoster Incoming JobPoster object. |
33 | 33 | * @return \Illuminate\Http\Response |
34 | 34 | */ |
35 | - public function index(JobPoster $jobPoster) |
|
35 | + public function index (JobPoster $jobPoster) |
|
36 | 36 | { |
37 | - $applications = $jobPoster->submitted_applications() |
|
38 | - ->with([ |
|
37 | + $applications = $jobPoster->submitted_applications () |
|
38 | + ->with ([ |
|
39 | 39 | 'veteran_status', |
40 | 40 | 'citizenship_declaration', |
41 | 41 | 'application_review', |
42 | 42 | 'applicant.user', |
43 | 43 | 'job_poster.criteria', |
44 | 44 | ]) |
45 | - ->get(); |
|
46 | - return view('manager/review_applications', [ |
|
45 | + ->get (); |
|
46 | + return view ('manager/review_applications', [ |
|
47 | 47 | // Localization Strings. |
48 | - 'jobs_l10n' => Lang::get('manager/job_index'), |
|
48 | + 'jobs_l10n' => Lang::get ('manager/job_index'), |
|
49 | 49 | // Data. |
50 | - 'job' => $jobPoster->toApiArray(), |
|
50 | + 'job' => $jobPoster->toApiArray (), |
|
51 | 51 | 'applications' => $applications, |
52 | - 'review_statuses' => ReviewStatus::all() |
|
52 | + 'review_statuses' => ReviewStatus::all () |
|
53 | 53 | ]); |
54 | 54 | } |
55 | 55 | |
@@ -59,16 +59,16 @@ discard block |
||
59 | 59 | * @param \App\Models\JobPoster $jobPoster Incoming JobPoster object. |
60 | 60 | * @return mixed|\App\Models\JobApplication |
61 | 61 | */ |
62 | - protected function getApplicationFromJob(JobPoster $jobPoster) |
|
62 | + protected function getApplicationFromJob (JobPoster $jobPoster) |
|
63 | 63 | { |
64 | - $application = JobApplication::where('applicant_id', Auth::user()->applicant->id) |
|
65 | - ->where('job_poster_id', $jobPoster->id)->first(); |
|
64 | + $application = JobApplication::where ('applicant_id', Auth::user ()->applicant->id) |
|
65 | + ->where ('job_poster_id', $jobPoster->id)->first (); |
|
66 | 66 | if ($application == null) { |
67 | - $application = new JobApplication(); |
|
67 | + $application = new JobApplication (); |
|
68 | 68 | $application->job_poster_id = $jobPoster->id; |
69 | - $application->applicant_id = Auth::user()->applicant->id; |
|
70 | - $application->application_status_id = ApplicationStatus::where('name', 'draft')->firstOrFail()->id; |
|
71 | - $application->save(); |
|
69 | + $application->applicant_id = Auth::user ()->applicant->id; |
|
70 | + $application->application_status_id = ApplicationStatus::where ('name', 'draft')->firstOrFail ()->id; |
|
71 | + $application->save (); |
|
72 | 72 | } |
73 | 73 | return $application; |
74 | 74 | } |
@@ -79,34 +79,34 @@ discard block |
||
79 | 79 | * @param \App\Models\JobPoster $jobPoster Incoming Job Poster object. |
80 | 80 | * @return \Illuminate\Http\Response |
81 | 81 | */ |
82 | - public function editBasics(JobPoster $jobPoster) |
|
82 | + public function editBasics (JobPoster $jobPoster) |
|
83 | 83 | { |
84 | - $applicant = Auth::user()->applicant; |
|
85 | - $application = $this->getApplicationFromJob($jobPoster); |
|
84 | + $applicant = Auth::user ()->applicant; |
|
85 | + $application = $this->getApplicationFromJob ($jobPoster); |
|
86 | 86 | |
87 | 87 | // Ensure user has permissions to view and update application. |
88 | - $this->authorize('view', $application); |
|
89 | - $this->authorize('update', $application); |
|
88 | + $this->authorize ('view', $application); |
|
89 | + $this->authorize ('update', $application); |
|
90 | 90 | |
91 | - return view( |
|
91 | + return view ( |
|
92 | 92 | 'applicant/application_post_01', |
93 | 93 | [ |
94 | 94 | // Application Template Data. |
95 | 95 | 'application_step' => 1, |
96 | - 'application_template' => Lang::get('applicant/application_template'), |
|
97 | - 'language_options' => PreferredLanguage::all(), |
|
98 | - 'citizenship_options' => CitizenshipDeclaration::all(), |
|
99 | - 'veteran_options' => VeteranStatus::all(), |
|
100 | - 'preferred_language_template' => Lang::get('common/preferred_language'), |
|
101 | - 'citizenship_declaration_template' => Lang::get('common/citizenship_declaration'), |
|
102 | - 'veteran_status_template' => Lang::get('common/veteran_status'), |
|
96 | + 'application_template' => Lang::get ('applicant/application_template'), |
|
97 | + 'language_options' => PreferredLanguage::all (), |
|
98 | + 'citizenship_options' => CitizenshipDeclaration::all (), |
|
99 | + 'veteran_options' => VeteranStatus::all (), |
|
100 | + 'preferred_language_template' => Lang::get ('common/preferred_language'), |
|
101 | + 'citizenship_declaration_template' => Lang::get ('common/citizenship_declaration'), |
|
102 | + 'veteran_status_template' => Lang::get ('common/veteran_status'), |
|
103 | 103 | // Job Data. |
104 | 104 | 'job' => $jobPoster, |
105 | 105 | // Applicant Data. |
106 | 106 | 'applicant' => $applicant, |
107 | 107 | 'job_application' => $application, |
108 | 108 | // Submission. |
109 | - 'form_submit_action' => route('job.application.update.1', $jobPoster) |
|
109 | + 'form_submit_action' => route ('job.application.update.1', $jobPoster) |
|
110 | 110 | ] |
111 | 111 | ); |
112 | 112 | } |
@@ -117,28 +117,28 @@ discard block |
||
117 | 117 | * @param \App\Models\JobPoster $jobPoster Incoming Job Poster object. |
118 | 118 | * @return \Illuminate\Http\Response |
119 | 119 | */ |
120 | - public function editExperience(JobPoster $jobPoster) |
|
120 | + public function editExperience (JobPoster $jobPoster) |
|
121 | 121 | { |
122 | - $applicant = Auth::user()->applicant; |
|
123 | - $application = $this->getApplicationFromJob($jobPoster); |
|
122 | + $applicant = Auth::user ()->applicant; |
|
123 | + $application = $this->getApplicationFromJob ($jobPoster); |
|
124 | 124 | |
125 | 125 | // Ensure user has permissions to view and update application. |
126 | - $this->authorize('view', $application); |
|
127 | - $this->authorize('update', $application); |
|
126 | + $this->authorize ('view', $application); |
|
127 | + $this->authorize ('update', $application); |
|
128 | 128 | |
129 | - return view( |
|
129 | + return view ( |
|
130 | 130 | 'applicant/application_post_02', |
131 | 131 | [ |
132 | 132 | // Application Template Data. |
133 | 133 | 'application_step' => 2, |
134 | - 'application_template' => Lang::get('applicant/application_template'), |
|
134 | + 'application_template' => Lang::get ('applicant/application_template'), |
|
135 | 135 | // Job Data. |
136 | 136 | 'job' => $jobPoster, |
137 | 137 | // Applicant Data. |
138 | 138 | 'applicant' => $applicant, |
139 | 139 | 'job_application' => $application, |
140 | 140 | // Submission. |
141 | - 'form_submit_action' => route('job.application.update.2', $jobPoster) |
|
141 | + 'form_submit_action' => route ('job.application.update.2', $jobPoster) |
|
142 | 142 | ] |
143 | 143 | ); |
144 | 144 | } |
@@ -149,41 +149,41 @@ discard block |
||
149 | 149 | * @param \App\Models\JobPoster $jobPoster Incoming Job Poster object. |
150 | 150 | * @return \Illuminate\Http\Response |
151 | 151 | */ |
152 | - public function editEssentialSkills(JobPoster $jobPoster) |
|
152 | + public function editEssentialSkills (JobPoster $jobPoster) |
|
153 | 153 | { |
154 | - $applicant = Auth::user()->applicant; |
|
155 | - $application = $this->getApplicationFromJob($jobPoster); |
|
154 | + $applicant = Auth::user ()->applicant; |
|
155 | + $application = $this->getApplicationFromJob ($jobPoster); |
|
156 | 156 | |
157 | 157 | // Ensure user has permissions to view and update application. |
158 | - $this->authorize('view', $application); |
|
159 | - $this->authorize('update', $application); |
|
158 | + $this->authorize ('view', $application); |
|
159 | + $this->authorize ('update', $application); |
|
160 | 160 | |
161 | 161 | $criteria = [ |
162 | - 'essential' => $jobPoster->criteria->filter(function ($value, $key) { |
|
162 | + 'essential' => $jobPoster->criteria->filter (function ($value, $key) { |
|
163 | 163 | return $value->criteria_type->name == 'essential'; |
164 | 164 | }), |
165 | - 'asset' => $jobPoster->criteria->filter(function ($value, $key) { |
|
165 | + 'asset' => $jobPoster->criteria->filter (function ($value, $key) { |
|
166 | 166 | return $value->criteria_type->name == 'asset'; |
167 | 167 | }), |
168 | 168 | ]; |
169 | 169 | |
170 | - return view( |
|
170 | + return view ( |
|
171 | 171 | 'applicant/application_post_03', |
172 | 172 | [ |
173 | 173 | // Application Template Data. |
174 | 174 | 'application_step' => 3, |
175 | - 'application_template' => Lang::get('applicant/application_template'), |
|
175 | + 'application_template' => Lang::get ('applicant/application_template'), |
|
176 | 176 | // Job Data. |
177 | 177 | 'job' => $jobPoster, |
178 | 178 | // Skills Data. |
179 | - 'skills' => Skill::all(), |
|
180 | - 'skill_template' => Lang::get('common/skills'), |
|
179 | + 'skills' => Skill::all (), |
|
180 | + 'skill_template' => Lang::get ('common/skills'), |
|
181 | 181 | 'criteria' => $criteria, |
182 | 182 | // Applicant Data. |
183 | 183 | 'applicant' => $applicant, |
184 | 184 | 'job_application' => $application, |
185 | 185 | // Submission. |
186 | - 'form_submit_action' => route('job.application.update.3', $jobPoster) |
|
186 | + 'form_submit_action' => route ('job.application.update.3', $jobPoster) |
|
187 | 187 | ] |
188 | 188 | ); |
189 | 189 | } |
@@ -194,41 +194,41 @@ discard block |
||
194 | 194 | * @param \App\Models\JobPoster $jobPoster Incoming Job Poster object. |
195 | 195 | * @return \Illuminate\Http\Response |
196 | 196 | */ |
197 | - public function editAssetSkills(JobPoster $jobPoster) |
|
197 | + public function editAssetSkills (JobPoster $jobPoster) |
|
198 | 198 | { |
199 | - $applicant = Auth::user()->applicant; |
|
200 | - $application = $this->getApplicationFromJob($jobPoster); |
|
199 | + $applicant = Auth::user ()->applicant; |
|
200 | + $application = $this->getApplicationFromJob ($jobPoster); |
|
201 | 201 | |
202 | 202 | // Ensure user has permissions to view and update application. |
203 | - $this->authorize('view', $application); |
|
204 | - $this->authorize('update', $application); |
|
203 | + $this->authorize ('view', $application); |
|
204 | + $this->authorize ('update', $application); |
|
205 | 205 | |
206 | 206 | $criteria = [ |
207 | - 'essential' => $jobPoster->criteria->filter(function ($value, $key) { |
|
207 | + 'essential' => $jobPoster->criteria->filter (function ($value, $key) { |
|
208 | 208 | return $value->criteria_type->name == 'essential'; |
209 | 209 | }), |
210 | - 'asset' => $jobPoster->criteria->filter(function ($value, $key) { |
|
210 | + 'asset' => $jobPoster->criteria->filter (function ($value, $key) { |
|
211 | 211 | return $value->criteria_type->name == 'asset'; |
212 | 212 | }), |
213 | 213 | ]; |
214 | 214 | |
215 | - return view( |
|
215 | + return view ( |
|
216 | 216 | 'applicant/application_post_04', |
217 | 217 | [ |
218 | 218 | // Application Template Data. |
219 | 219 | 'application_step' => 4, |
220 | - 'application_template' => Lang::get('applicant/application_template'), |
|
220 | + 'application_template' => Lang::get ('applicant/application_template'), |
|
221 | 221 | // Job Data. |
222 | 222 | 'job' => $jobPoster, |
223 | 223 | // Skills Data. |
224 | - 'skills' => Skill::all(), |
|
225 | - 'skill_template' => Lang::get('common/skills'), |
|
224 | + 'skills' => Skill::all (), |
|
225 | + 'skill_template' => Lang::get ('common/skills'), |
|
226 | 226 | 'criteria' => $criteria, |
227 | 227 | // Applicant Data. |
228 | 228 | 'applicant' => $applicant, |
229 | 229 | 'job_application' => $application, |
230 | 230 | // Submission. |
231 | - 'form_submit_action' => route('job.application.update.4', $jobPoster) |
|
231 | + 'form_submit_action' => route ('job.application.update.4', $jobPoster) |
|
232 | 232 | ] |
233 | 233 | ); |
234 | 234 | } |
@@ -239,40 +239,40 @@ discard block |
||
239 | 239 | * @param \App\Models\JobPoster $jobPoster Incoming Job Poster object. |
240 | 240 | * @return \Illuminate\Http\Response |
241 | 241 | */ |
242 | - public function preview(JobPoster $jobPoster) |
|
242 | + public function preview (JobPoster $jobPoster) |
|
243 | 243 | { |
244 | - $applicant = Auth::user()->applicant; |
|
245 | - $application = $this->getApplicationFromJob($jobPoster); |
|
244 | + $applicant = Auth::user ()->applicant; |
|
245 | + $application = $this->getApplicationFromJob ($jobPoster); |
|
246 | 246 | |
247 | - $this->authorize('view', $application); |
|
247 | + $this->authorize ('view', $application); |
|
248 | 248 | $criteria = [ |
249 | - 'essential' => $jobPoster->criteria->filter(function ($value, $key) { |
|
249 | + 'essential' => $jobPoster->criteria->filter (function ($value, $key) { |
|
250 | 250 | return $value->criteria_type->name == 'essential'; |
251 | 251 | }), |
252 | - 'asset' => $jobPoster->criteria->filter(function ($value, $key) { |
|
252 | + 'asset' => $jobPoster->criteria->filter (function ($value, $key) { |
|
253 | 253 | return $value->criteria_type->name == 'asset'; |
254 | 254 | }), |
255 | 255 | ]; |
256 | 256 | |
257 | - return view( |
|
257 | + return view ( |
|
258 | 258 | 'applicant/application_post_05', |
259 | 259 | [ |
260 | 260 | // Application Template Data. |
261 | 261 | 'application_step' => 5, |
262 | - 'application_template' => Lang::get('applicant/application_template'), |
|
263 | - 'preferred_language_template' => Lang::get('common/preferred_language'), |
|
264 | - 'citizenship_declaration_template' => Lang::get('common/citizenship_declaration'), |
|
265 | - 'veteran_status_template' => Lang::get('common/veteran_status'), |
|
262 | + 'application_template' => Lang::get ('applicant/application_template'), |
|
263 | + 'preferred_language_template' => Lang::get ('common/preferred_language'), |
|
264 | + 'citizenship_declaration_template' => Lang::get ('common/citizenship_declaration'), |
|
265 | + 'veteran_status_template' => Lang::get ('common/veteran_status'), |
|
266 | 266 | // Job Data. |
267 | 267 | 'job' => $jobPoster, |
268 | 268 | // Skills Data. |
269 | - 'skills' => Skill::all(), |
|
270 | - 'skill_template' => Lang::get('common/skills'), |
|
269 | + 'skills' => Skill::all (), |
|
270 | + 'skill_template' => Lang::get ('common/skills'), |
|
271 | 271 | 'criteria' => $criteria, |
272 | 272 | // Applicant Data. |
273 | 273 | 'applicant' => $applicant, |
274 | 274 | 'job_application' => $application, |
275 | - 'is_manager_view' => WhichPortal::isManagerPortal(), |
|
275 | + 'is_manager_view' => WhichPortal::isManagerPortal (), |
|
276 | 276 | ] |
277 | 277 | ); |
278 | 278 | } |
@@ -283,24 +283,24 @@ discard block |
||
283 | 283 | * @param \App\Models\JobPoster $jobPoster Incoming Job Poster object. |
284 | 284 | * @return \Illuminate\Http\Response |
285 | 285 | */ |
286 | - public function confirm(JobPoster $jobPoster) |
|
286 | + public function confirm (JobPoster $jobPoster) |
|
287 | 287 | { |
288 | - $applicant = Auth::user()->applicant; |
|
289 | - $application = $this->getApplicationFromJob($jobPoster); |
|
288 | + $applicant = Auth::user ()->applicant; |
|
289 | + $application = $this->getApplicationFromJob ($jobPoster); |
|
290 | 290 | |
291 | - $this->authorize('update', $application); |
|
291 | + $this->authorize ('update', $application); |
|
292 | 292 | |
293 | - return view( |
|
293 | + return view ( |
|
294 | 294 | 'applicant/application_post_06', |
295 | 295 | [ |
296 | 296 | // Application Template Data. |
297 | 297 | 'application_step' => 6, |
298 | - 'application_template' => Lang::get('applicant/application_template'), |
|
298 | + 'application_template' => Lang::get ('applicant/application_template'), |
|
299 | 299 | // Used by tracker partial. |
300 | 300 | 'job' => $jobPoster, |
301 | 301 | 'job_application' => $application, |
302 | 302 | // Submission. |
303 | - 'form_submit_action' => route('job.application.submit', $jobPoster) |
|
303 | + 'form_submit_action' => route ('job.application.submit', $jobPoster) |
|
304 | 304 | ] |
305 | 305 | ); |
306 | 306 | } |
@@ -311,22 +311,22 @@ discard block |
||
311 | 311 | * @param \App\Models\JobPoster $jobPoster Incoming Job Poster object. |
312 | 312 | * @return \Illuminate\Http\Response |
313 | 313 | */ |
314 | - public function complete(JobPoster $jobPoster) |
|
314 | + public function complete (JobPoster $jobPoster) |
|
315 | 315 | { |
316 | 316 | // Include Applicant Data. |
317 | - $applicant = Auth::user()->applicant; |
|
317 | + $applicant = Auth::user ()->applicant; |
|
318 | 318 | // Include Application Data. |
319 | - $application = $this->getApplicationFromJob($jobPoster); |
|
319 | + $application = $this->getApplicationFromJob ($jobPoster); |
|
320 | 320 | |
321 | 321 | // Ensure user has permissions to view application. |
322 | - $this->authorize('view', $application); |
|
322 | + $this->authorize ('view', $application); |
|
323 | 323 | |
324 | 324 | // Return the Completion View. |
325 | - return view( |
|
325 | + return view ( |
|
326 | 326 | 'applicant/application_post_complete', |
327 | 327 | [ |
328 | 328 | // Application Template Data. |
329 | - 'application_template' => Lang::get('applicant/application_template'), |
|
329 | + 'application_template' => Lang::get ('applicant/application_template'), |
|
330 | 330 | // Job Data. |
331 | 331 | 'job' => $jobPoster, |
332 | 332 | // Applicant Data. |
@@ -343,52 +343,52 @@ discard block |
||
343 | 343 | * @param \App\Models\JobPoster $jobPoster Incoming Job Poster object. |
344 | 344 | * @return \Illuminate\Http\Response |
345 | 345 | */ |
346 | - public function updateBasics(Request $request, JobPoster $jobPoster) |
|
346 | + public function updateBasics (Request $request, JobPoster $jobPoster) |
|
347 | 347 | { |
348 | - $applicant = Auth::user()->applicant; |
|
349 | - $application = $this->getApplicationFromJob($jobPoster); |
|
348 | + $applicant = Auth::user ()->applicant; |
|
349 | + $application = $this->getApplicationFromJob ($jobPoster); |
|
350 | 350 | |
351 | 351 | // Ensure user has permissions to update this application. |
352 | - $this->authorize('update', $application); |
|
352 | + $this->authorize ('update', $application); |
|
353 | 353 | |
354 | - $application->fill([ |
|
355 | - 'citizenship_declaration_id' => $request->input('citizenship_declaration_id'), |
|
356 | - 'veteran_status_id' => $request->input('veteran_status_id'), |
|
357 | - 'preferred_language_id' => $request->input('preferred_language_id'), |
|
358 | - 'language_requirement_confirmed' => $request->input('language_requirement_confirmed') |
|
354 | + $application->fill ([ |
|
355 | + 'citizenship_declaration_id' => $request->input ('citizenship_declaration_id'), |
|
356 | + 'veteran_status_id' => $request->input ('veteran_status_id'), |
|
357 | + 'preferred_language_id' => $request->input ('preferred_language_id'), |
|
358 | + 'language_requirement_confirmed' => $request->input ('language_requirement_confirmed') |
|
359 | 359 | ]); |
360 | - $application->save(); |
|
360 | + $application->save (); |
|
361 | 361 | |
362 | 362 | $questions = $jobPoster->job_poster_questions; |
363 | - $questionsInput = $request->input('questions'); |
|
363 | + $questionsInput = $request->input ('questions'); |
|
364 | 364 | foreach ($questions as $question) { |
365 | 365 | $answer = null; |
366 | 366 | if (isset($questionsInput[$question->id])) { |
367 | 367 | $answer = $questionsInput[$question->id]; |
368 | 368 | } |
369 | 369 | $answerObj = $application->job_application_answers |
370 | - ->firstWhere('job_poster_question_id', $question->id); |
|
370 | + ->firstWhere ('job_poster_question_id', $question->id); |
|
371 | 371 | if ($answerObj == null) { |
372 | - $answerObj = new JobApplicationAnswer(); |
|
372 | + $answerObj = new JobApplicationAnswer (); |
|
373 | 373 | $answerObj->job_poster_question_id = $question->id; |
374 | 374 | $answerObj->job_application_id = $application->id; |
375 | 375 | } |
376 | 376 | $answerObj->answer = $answer; |
377 | - $answerObj->save(); |
|
377 | + $answerObj->save (); |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | // Redirect to correct page. |
381 | - switch ($request->input('submit')) { |
|
381 | + switch ($request->input ('submit')) { |
|
382 | 382 | case 'save_and_quit': |
383 | 383 | case 'previous': |
384 | - return redirect()->route('applications.index'); |
|
384 | + return redirect ()->route ('applications.index'); |
|
385 | 385 | break; |
386 | 386 | case 'save_and_continue': |
387 | 387 | case 'next': |
388 | - return redirect()->route('job.application.edit.2', $jobPoster); |
|
388 | + return redirect ()->route ('job.application.edit.2', $jobPoster); |
|
389 | 389 | break; |
390 | 390 | default: |
391 | - return redirect()->back()->withInput(); |
|
391 | + return redirect ()->back ()->withInput (); |
|
392 | 392 | } |
393 | 393 | } |
394 | 394 | |
@@ -399,21 +399,21 @@ discard block |
||
399 | 399 | * @param \App\Models\JobPoster $jobPoster Incoming Job Poster object. |
400 | 400 | * @return \Illuminate\Http\Response |
401 | 401 | */ |
402 | - public function updateExperience(Request $request, JobPoster $jobPoster) |
|
402 | + public function updateExperience (Request $request, JobPoster $jobPoster) |
|
403 | 403 | { |
404 | - $applicant = Auth::user()->applicant; |
|
405 | - $application = $this->getApplicationFromJob($jobPoster); |
|
404 | + $applicant = Auth::user ()->applicant; |
|
405 | + $application = $this->getApplicationFromJob ($jobPoster); |
|
406 | 406 | |
407 | 407 | // Ensure user has permissions to update this application. |
408 | - $this->authorize('update', $application); |
|
408 | + $this->authorize ('update', $application); |
|
409 | 409 | |
410 | 410 | // Record that the user has saved their experience for this application. |
411 | 411 | $application->experience_saved = true; |
412 | - $application->save(); |
|
412 | + $application->save (); |
|
413 | 413 | |
414 | - $degrees = $request->input('degrees'); |
|
414 | + $degrees = $request->input ('degrees'); |
|
415 | 415 | |
416 | - $request->validate([ |
|
416 | + $request->validate ([ |
|
417 | 417 | 'degrees.new.*.degree_type_id' => 'required', |
418 | 418 | 'degrees.new.*.area_of_study' => 'required', |
419 | 419 | 'degrees.new.*.institution' => 'required', |
@@ -426,9 +426,9 @@ discard block |
||
426 | 426 | // Save new degrees. |
427 | 427 | if (isset($degrees['new'])) { |
428 | 428 | foreach ($degrees['new'] as $degreeInput) { |
429 | - $degree = new Degree(); |
|
429 | + $degree = new Degree (); |
|
430 | 430 | $degree->applicant_id = $applicant->id; |
431 | - $degree->fill([ |
|
431 | + $degree->fill ([ |
|
432 | 432 | 'degree_type_id' => $degreeInput['degree_type_id'], |
433 | 433 | 'area_of_study' => $degreeInput['area_of_study'], |
434 | 434 | 'institution' => $degreeInput['institution'], |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | 'end_date' => $degreeInput['end_date'], |
438 | 438 | 'blockcert_url' => $degreeInput['blockcert_url'], |
439 | 439 | ]); |
440 | - $degree->save(); |
|
440 | + $degree->save (); |
|
441 | 441 | } |
442 | 442 | } |
443 | 443 | |
@@ -445,9 +445,9 @@ discard block |
||
445 | 445 | if (isset($degrees['old'])) { |
446 | 446 | foreach ($degrees['old'] as $id => $degreeInput) { |
447 | 447 | // Ensure this degree belongs to this applicant. |
448 | - $degree = $applicant->degrees->firstWhere('id', $id); |
|
448 | + $degree = $applicant->degrees->firstWhere ('id', $id); |
|
449 | 449 | if ($degree != null) { |
450 | - $degree->fill([ |
|
450 | + $degree->fill ([ |
|
451 | 451 | 'degree_type_id' => $degreeInput['degree_type_id'], |
452 | 452 | 'area_of_study' => $degreeInput['area_of_study'], |
453 | 453 | 'institution' => $degreeInput['institution'], |
@@ -456,16 +456,16 @@ discard block |
||
456 | 456 | 'end_date' => $degreeInput['end_date'], |
457 | 457 | 'blockcert_url' => $degreeInput['blockcert_url'], |
458 | 458 | ]); |
459 | - $degree->save(); |
|
459 | + $degree->save (); |
|
460 | 460 | } else { |
461 | - Log::warning("Applicant $applicant->id attempted to update degree with invalid id: $id"); |
|
461 | + Log::warning ("Applicant $applicant->id attempted to update degree with invalid id: $id"); |
|
462 | 462 | } |
463 | 463 | } |
464 | 464 | } |
465 | 465 | |
466 | - $courses = $request->input('courses'); |
|
466 | + $courses = $request->input ('courses'); |
|
467 | 467 | |
468 | - $request->validate([ |
|
468 | + $request->validate ([ |
|
469 | 469 | 'courses.new.*.name' => 'required', |
470 | 470 | 'courses.new.*.institution' => 'required', |
471 | 471 | 'courses.new.*.course_status_id' => 'required', |
@@ -476,16 +476,16 @@ discard block |
||
476 | 476 | // Save new courses. |
477 | 477 | if (isset($courses['new'])) { |
478 | 478 | foreach ($courses['new'] as $courseInput) { |
479 | - $course = new Course(); |
|
479 | + $course = new Course (); |
|
480 | 480 | $course->applicant_id = $applicant->id; |
481 | - $course->fill([ |
|
481 | + $course->fill ([ |
|
482 | 482 | 'name' => $courseInput['name'], |
483 | 483 | 'institution' => $courseInput['institution'], |
484 | 484 | 'course_status_id' => $courseInput['course_status_id'], |
485 | 485 | 'start_date' => $courseInput['start_date'], |
486 | 486 | 'end_date' => $courseInput['end_date'] |
487 | 487 | ]); |
488 | - $course->save(); |
|
488 | + $course->save (); |
|
489 | 489 | } |
490 | 490 | } |
491 | 491 | |
@@ -493,25 +493,25 @@ discard block |
||
493 | 493 | if (isset($courses['old'])) { |
494 | 494 | foreach ($courses['old'] as $id => $courseInput) { |
495 | 495 | // Ensure this course belongs to this applicant. |
496 | - $course = $applicant->courses->firstWhere('id', $id); |
|
496 | + $course = $applicant->courses->firstWhere ('id', $id); |
|
497 | 497 | if ($course != null) { |
498 | - $course->fill([ |
|
498 | + $course->fill ([ |
|
499 | 499 | 'name' => $courseInput['name'], |
500 | 500 | 'institution' => $courseInput['institution'], |
501 | 501 | 'course_status_id' => $courseInput['course_status_id'], |
502 | 502 | 'start_date' => $courseInput['start_date'], |
503 | 503 | 'end_date' => $courseInput['end_date'] |
504 | 504 | ]); |
505 | - $course->save(); |
|
505 | + $course->save (); |
|
506 | 506 | } else { |
507 | - Log::warning("Applicant $applicant->id attempted to update course with invalid id: $id"); |
|
507 | + Log::warning ("Applicant $applicant->id attempted to update course with invalid id: $id"); |
|
508 | 508 | } |
509 | 509 | } |
510 | 510 | } |
511 | 511 | |
512 | - $work_experiences = $request->input('work_experiences'); |
|
512 | + $work_experiences = $request->input ('work_experiences'); |
|
513 | 513 | |
514 | - $request->validate([ |
|
514 | + $request->validate ([ |
|
515 | 515 | 'work_experiences.new.*.role' => 'required', |
516 | 516 | 'work_experiences.new.*.company' => 'required', |
517 | 517 | 'work_experiences.new.*.description' => 'required', |
@@ -522,16 +522,16 @@ discard block |
||
522 | 522 | // Save new work_experiences. |
523 | 523 | if (isset($work_experiences['new'])) { |
524 | 524 | foreach ($work_experiences['new'] as $workExperienceInput) { |
525 | - $workExperience = new WorkExperience(); |
|
525 | + $workExperience = new WorkExperience (); |
|
526 | 526 | $workExperience->applicant_id = $applicant->id; |
527 | - $workExperience->fill([ |
|
527 | + $workExperience->fill ([ |
|
528 | 528 | 'role' => $workExperienceInput['role'], |
529 | 529 | 'company' => $workExperienceInput['company'], |
530 | 530 | 'description' => $workExperienceInput['description'], |
531 | 531 | 'start_date' => $workExperienceInput['start_date'], |
532 | 532 | 'end_date' => $workExperienceInput['end_date'] |
533 | 533 | ]); |
534 | - $workExperience->save(); |
|
534 | + $workExperience->save (); |
|
535 | 535 | } |
536 | 536 | } |
537 | 537 | |
@@ -539,36 +539,36 @@ discard block |
||
539 | 539 | if (isset($work_experiences['old'])) { |
540 | 540 | foreach ($work_experiences['old'] as $id => $workExperienceInput) { |
541 | 541 | // Ensure this work_experience belongs to this applicant. |
542 | - $workExperience = $applicant->work_experiences->firstWhere('id', $id); |
|
542 | + $workExperience = $applicant->work_experiences->firstWhere ('id', $id); |
|
543 | 543 | if ($workExperience != null) { |
544 | - $workExperience->fill([ |
|
544 | + $workExperience->fill ([ |
|
545 | 545 | 'role' => $workExperienceInput['role'], |
546 | 546 | 'company' => $workExperienceInput['company'], |
547 | 547 | 'description' => $workExperienceInput['description'], |
548 | 548 | 'start_date' => $workExperienceInput['start_date'], |
549 | 549 | 'end_date' => $workExperienceInput['end_date'] |
550 | 550 | ]); |
551 | - $workExperience->save(); |
|
551 | + $workExperience->save (); |
|
552 | 552 | } else { |
553 | - Log::warning("Applicant $applicant->id attempted to update work_experience with invalid id: $id"); |
|
553 | + Log::warning ("Applicant $applicant->id attempted to update work_experience with invalid id: $id"); |
|
554 | 554 | } |
555 | 555 | } |
556 | 556 | } |
557 | 557 | |
558 | 558 | // Redirect to correct page. |
559 | - switch ($request->input('submit')) { |
|
559 | + switch ($request->input ('submit')) { |
|
560 | 560 | case 'save_and_quit': |
561 | - return redirect()->route('applications.index'); |
|
561 | + return redirect ()->route ('applications.index'); |
|
562 | 562 | break; |
563 | 563 | case 'save_and_continue': |
564 | 564 | case 'next': |
565 | - return redirect()->route('job.application.edit.3', $jobPoster); |
|
565 | + return redirect ()->route ('job.application.edit.3', $jobPoster); |
|
566 | 566 | break; |
567 | 567 | case 'previous': |
568 | - return redirect()->route('job.application.edit.1', $jobPoster); |
|
568 | + return redirect ()->route ('job.application.edit.1', $jobPoster); |
|
569 | 569 | break; |
570 | 570 | default: |
571 | - return redirect()->back()->withInput(); |
|
571 | + return redirect ()->back ()->withInput (); |
|
572 | 572 | } |
573 | 573 | } |
574 | 574 | |
@@ -579,36 +579,36 @@ discard block |
||
579 | 579 | * @param \App\Models\JobPoster $jobPoster Incoming Job Poster object. |
580 | 580 | * @return \Illuminate\Http\Response |
581 | 581 | */ |
582 | - public function updateEssentialSkills(Request $request, JobPoster $jobPoster) |
|
582 | + public function updateEssentialSkills (Request $request, JobPoster $jobPoster) |
|
583 | 583 | { |
584 | - $applicant = Auth::user()->applicant; |
|
585 | - $application = $this->getApplicationFromJob($jobPoster); |
|
584 | + $applicant = Auth::user ()->applicant; |
|
585 | + $application = $this->getApplicationFromJob ($jobPoster); |
|
586 | 586 | |
587 | 587 | // Ensure user has permissions to update this application. |
588 | - $this->authorize('update', $application); |
|
588 | + $this->authorize ('update', $application); |
|
589 | 589 | |
590 | - $skillDeclarations = $request->input('skill_declarations'); |
|
591 | - $claimedStatusId = SkillStatus::where('name', 'claimed')->firstOrFail()->id; |
|
590 | + $skillDeclarations = $request->input ('skill_declarations'); |
|
591 | + $claimedStatusId = SkillStatus::where ('name', 'claimed')->firstOrFail ()->id; |
|
592 | 592 | |
593 | 593 | // Save new skill declarartions. |
594 | 594 | if (isset($skillDeclarations['new'])) { |
595 | 595 | foreach ($skillDeclarations['new'] as $skillType => $typeInput) { |
596 | 596 | foreach ($typeInput as $criterion_id => $skillDeclarationInput) { |
597 | - $skillDeclaration = new SkillDeclaration(); |
|
597 | + $skillDeclaration = new SkillDeclaration (); |
|
598 | 598 | $skillDeclaration->applicant_id = $applicant->id; |
599 | - $skillDeclaration->skill_id = Criteria::find($criterion_id)->skill->id; |
|
599 | + $skillDeclaration->skill_id = Criteria::find ($criterion_id)->skill->id; |
|
600 | 600 | $skillDeclaration->skill_status_id = $claimedStatusId; |
601 | - $skillDeclaration->fill([ |
|
601 | + $skillDeclaration->fill ([ |
|
602 | 602 | 'description' => $skillDeclarationInput['description'], |
603 | 603 | 'skill_level_id' => isset($skillDeclarationInput['skill_level_id']) ? $skillDeclarationInput['skill_level_id'] : null, |
604 | 604 | ]); |
605 | - $skillDeclaration->save(); |
|
605 | + $skillDeclaration->save (); |
|
606 | 606 | |
607 | - $referenceIds = $this->getRelativeIds($skillDeclarationInput, 'references'); |
|
608 | - $skillDeclaration->references()->sync($referenceIds); |
|
607 | + $referenceIds = $this->getRelativeIds ($skillDeclarationInput, 'references'); |
|
608 | + $skillDeclaration->references ()->sync ($referenceIds); |
|
609 | 609 | |
610 | - $sampleIds = $this->getRelativeIds($skillDeclarationInput, 'samples'); |
|
611 | - $skillDeclaration->work_samples()->sync($sampleIds); |
|
610 | + $sampleIds = $this->getRelativeIds ($skillDeclarationInput, 'samples'); |
|
611 | + $skillDeclaration->work_samples ()->sync ($sampleIds); |
|
612 | 612 | } |
613 | 613 | } |
614 | 614 | } |
@@ -618,41 +618,41 @@ discard block |
||
618 | 618 | foreach ($skillDeclarations['old'] as $skillType => $typeInput) { |
619 | 619 | foreach ($typeInput as $id => $skillDeclarationInput) { |
620 | 620 | // Ensure this declaration belongs to this applicant. |
621 | - $skillDeclaration = $applicant->skill_declarations->firstWhere('id', $id); |
|
621 | + $skillDeclaration = $applicant->skill_declarations->firstWhere ('id', $id); |
|
622 | 622 | if ($skillDeclaration != null) { |
623 | 623 | // skill_id and skill_status cannot be changed. |
624 | - $skillDeclaration->fill([ |
|
624 | + $skillDeclaration->fill ([ |
|
625 | 625 | 'description' => $skillDeclarationInput['description'], |
626 | 626 | 'skill_level_id' => isset($skillDeclarationInput['skill_level_id']) ? $skillDeclarationInput['skill_level_id'] : null, |
627 | 627 | ]); |
628 | - $skillDeclaration->save(); |
|
628 | + $skillDeclaration->save (); |
|
629 | 629 | |
630 | - $referenceIds = $this->getRelativeIds($skillDeclarationInput, 'references'); |
|
631 | - $skillDeclaration->references()->sync($referenceIds); |
|
630 | + $referenceIds = $this->getRelativeIds ($skillDeclarationInput, 'references'); |
|
631 | + $skillDeclaration->references ()->sync ($referenceIds); |
|
632 | 632 | |
633 | - $sampleIds = $this->getRelativeIds($skillDeclarationInput, 'samples'); |
|
634 | - $skillDeclaration->work_samples()->sync($sampleIds); |
|
633 | + $sampleIds = $this->getRelativeIds ($skillDeclarationInput, 'samples'); |
|
634 | + $skillDeclaration->work_samples ()->sync ($sampleIds); |
|
635 | 635 | } else { |
636 | - Log::warning("Applicant $applicant->id attempted to update skill declaration with invalid id: $id"); |
|
636 | + Log::warning ("Applicant $applicant->id attempted to update skill declaration with invalid id: $id"); |
|
637 | 637 | } |
638 | 638 | } |
639 | 639 | } |
640 | 640 | } |
641 | 641 | |
642 | 642 | // Redirect to correct page. |
643 | - switch ($request->input('submit')) { |
|
643 | + switch ($request->input ('submit')) { |
|
644 | 644 | case 'save_and_quit': |
645 | - return redirect()->route('applications.index'); |
|
645 | + return redirect ()->route ('applications.index'); |
|
646 | 646 | break; |
647 | 647 | case 'save_and_continue': |
648 | 648 | case 'next': |
649 | - return redirect()->route('job.application.edit.4', $jobPoster); |
|
649 | + return redirect ()->route ('job.application.edit.4', $jobPoster); |
|
650 | 650 | break; |
651 | 651 | case 'previous': |
652 | - return redirect()->route('job.application.edit.2', $jobPoster); |
|
652 | + return redirect ()->route ('job.application.edit.2', $jobPoster); |
|
653 | 653 | break; |
654 | 654 | default: |
655 | - return redirect()->back()->withInput(); |
|
655 | + return redirect ()->back ()->withInput (); |
|
656 | 656 | } |
657 | 657 | } |
658 | 658 | |
@@ -663,36 +663,36 @@ discard block |
||
663 | 663 | * @param \App\Models\JobPoster $jobPoster Incoming Job Poster object. |
664 | 664 | * @return \Illuminate\Http\Response |
665 | 665 | */ |
666 | - public function updateAssetSkills(Request $request, JobPoster $jobPoster) |
|
666 | + public function updateAssetSkills (Request $request, JobPoster $jobPoster) |
|
667 | 667 | { |
668 | - $applicant = Auth::user()->applicant; |
|
669 | - $application = $this->getApplicationFromJob($jobPoster); |
|
668 | + $applicant = Auth::user ()->applicant; |
|
669 | + $application = $this->getApplicationFromJob ($jobPoster); |
|
670 | 670 | |
671 | 671 | // Ensure user has permissions to update this application. |
672 | - $this->authorize('update', $application); |
|
672 | + $this->authorize ('update', $application); |
|
673 | 673 | |
674 | - $skillDeclarations = $request->input('skill_declarations'); |
|
675 | - $claimedStatusId = SkillStatus::where('name', 'claimed')->firstOrFail()->id; |
|
674 | + $skillDeclarations = $request->input ('skill_declarations'); |
|
675 | + $claimedStatusId = SkillStatus::where ('name', 'claimed')->firstOrFail ()->id; |
|
676 | 676 | |
677 | 677 | // Save new skill declarartions. |
678 | 678 | if (isset($skillDeclarations['new'])) { |
679 | 679 | foreach ($skillDeclarations['new'] as $skillType => $typeInput) { |
680 | 680 | foreach ($typeInput as $criterion_id => $skillDeclarationInput) { |
681 | - $skillDeclaration = new SkillDeclaration(); |
|
681 | + $skillDeclaration = new SkillDeclaration (); |
|
682 | 682 | $skillDeclaration->applicant_id = $applicant->id; |
683 | - $skillDeclaration->skill_id = Criteria::find($criterion_id)->skill->id; |
|
683 | + $skillDeclaration->skill_id = Criteria::find ($criterion_id)->skill->id; |
|
684 | 684 | $skillDeclaration->skill_status_id = $claimedStatusId; |
685 | - $skillDeclaration->fill([ |
|
685 | + $skillDeclaration->fill ([ |
|
686 | 686 | 'description' => $skillDeclarationInput['description'], |
687 | 687 | 'skill_level_id' => isset($skillDeclarationInput['skill_level_id']) ? $skillDeclarationInput['skill_level_id'] : null, |
688 | 688 | ]); |
689 | - $skillDeclaration->save(); |
|
689 | + $skillDeclaration->save (); |
|
690 | 690 | |
691 | - $referenceIds = $this->getRelativeIds($skillDeclarationInput, 'references'); |
|
692 | - $skillDeclaration->references()->sync($referenceIds); |
|
691 | + $referenceIds = $this->getRelativeIds ($skillDeclarationInput, 'references'); |
|
692 | + $skillDeclaration->references ()->sync ($referenceIds); |
|
693 | 693 | |
694 | - $sampleIds = $this->getRelativeIds($skillDeclarationInput, 'samples'); |
|
695 | - $skillDeclaration->work_samples()->sync($sampleIds); |
|
694 | + $sampleIds = $this->getRelativeIds ($skillDeclarationInput, 'samples'); |
|
695 | + $skillDeclaration->work_samples ()->sync ($sampleIds); |
|
696 | 696 | } |
697 | 697 | } |
698 | 698 | } |
@@ -702,41 +702,41 @@ discard block |
||
702 | 702 | foreach ($skillDeclarations['old'] as $skillType => $typeInput) { |
703 | 703 | foreach ($typeInput as $id => $skillDeclarationInput) { |
704 | 704 | // Ensure this declaration belongs to this applicant. |
705 | - $skillDeclaration = $applicant->skill_declarations->firstWhere('id', $id); |
|
705 | + $skillDeclaration = $applicant->skill_declarations->firstWhere ('id', $id); |
|
706 | 706 | if ($skillDeclaration != null) { |
707 | 707 | // skill_id and skill_status cannot be changed. |
708 | - $skillDeclaration->fill([ |
|
708 | + $skillDeclaration->fill ([ |
|
709 | 709 | 'description' => $skillDeclarationInput['description'], |
710 | 710 | 'skill_level_id' => isset($skillDeclarationInput['skill_level_id']) ? $skillDeclarationInput['skill_level_id'] : null, |
711 | 711 | ]); |
712 | - $skillDeclaration->save(); |
|
712 | + $skillDeclaration->save (); |
|
713 | 713 | |
714 | - $referenceIds = $this->getRelativeIds($skillDeclarationInput, 'references'); |
|
715 | - $skillDeclaration->references()->sync($referenceIds); |
|
714 | + $referenceIds = $this->getRelativeIds ($skillDeclarationInput, 'references'); |
|
715 | + $skillDeclaration->references ()->sync ($referenceIds); |
|
716 | 716 | |
717 | - $sampleIds = $this->getRelativeIds($skillDeclarationInput, 'samples'); |
|
718 | - $skillDeclaration->work_samples()->sync($sampleIds); |
|
717 | + $sampleIds = $this->getRelativeIds ($skillDeclarationInput, 'samples'); |
|
718 | + $skillDeclaration->work_samples ()->sync ($sampleIds); |
|
719 | 719 | } else { |
720 | - Log::warning("Applicant $applicant->id attempted to update skill declaration with invalid id: $id"); |
|
720 | + Log::warning ("Applicant $applicant->id attempted to update skill declaration with invalid id: $id"); |
|
721 | 721 | } |
722 | 722 | } |
723 | 723 | } |
724 | 724 | } |
725 | 725 | |
726 | 726 | // Redirect to correct page. |
727 | - switch ($request->input('submit')) { |
|
727 | + switch ($request->input ('submit')) { |
|
728 | 728 | case 'save_and_quit': |
729 | - return redirect()->route('applications.index'); |
|
729 | + return redirect ()->route ('applications.index'); |
|
730 | 730 | break; |
731 | 731 | case 'save_and_continue': |
732 | 732 | case 'next': |
733 | - return redirect()->route('job.application.edit.5', $jobPoster); |
|
733 | + return redirect ()->route ('job.application.edit.5', $jobPoster); |
|
734 | 734 | break; |
735 | 735 | case 'previous': |
736 | - return redirect()->route('job.application.edit.3', $jobPoster); |
|
736 | + return redirect ()->route ('job.application.edit.3', $jobPoster); |
|
737 | 737 | break; |
738 | 738 | default: |
739 | - return redirect()->back()->withInput(); |
|
739 | + return redirect ()->back ()->withInput (); |
|
740 | 740 | } |
741 | 741 | } |
742 | 742 | |
@@ -747,17 +747,17 @@ discard block |
||
747 | 747 | * @param \App\Models\JobPoster $jobPoster Incoming Job Poster object. |
748 | 748 | * @return \Illuminate\Http\Response |
749 | 749 | */ |
750 | - public function submit(Request $request, JobPoster $jobPoster) |
|
750 | + public function submit (Request $request, JobPoster $jobPoster) |
|
751 | 751 | { |
752 | - $applicant = Auth::user()->applicant; |
|
753 | - $application = $this->getApplicationFromJob($jobPoster); |
|
752 | + $applicant = Auth::user ()->applicant; |
|
753 | + $application = $this->getApplicationFromJob ($jobPoster); |
|
754 | 754 | |
755 | 755 | // Ensure user has permissions to update this application. |
756 | - $this->authorize('update', $application); |
|
756 | + $this->authorize ('update', $application); |
|
757 | 757 | |
758 | 758 | // Only complete submission if submit button was pressed. |
759 | - if ($request->input('submit') == 'submit') { |
|
760 | - $request->validate([ |
|
759 | + if ($request->input ('submit') == 'submit') { |
|
760 | + $request->validate ([ |
|
761 | 761 | 'submission_signature' => [ |
762 | 762 | 'required', |
763 | 763 | 'string', |
@@ -771,33 +771,33 @@ discard block |
||
771 | 771 | ]); |
772 | 772 | |
773 | 773 | // Save any final info. |
774 | - $application->fill([ |
|
775 | - 'submission_signature' => $request->input('submission_signature'), |
|
776 | - 'submission_date' => $request->input('submission_date'), |
|
774 | + $application->fill ([ |
|
775 | + 'submission_signature' => $request->input ('submission_signature'), |
|
776 | + 'submission_date' => $request->input ('submission_date'), |
|
777 | 777 | ]); |
778 | 778 | |
779 | - $validator = new ApplicationValidator(); |
|
780 | - $validator->validate($application); |
|
779 | + $validator = new ApplicationValidator (); |
|
780 | + $validator->validate ($application); |
|
781 | 781 | |
782 | 782 | // Change status to 'submitted'. |
783 | - $application->application_status_id = ApplicationStatus::where('name', 'submitted')->firstOrFail()->id; |
|
783 | + $application->application_status_id = ApplicationStatus::where ('name', 'submitted')->firstOrFail ()->id; |
|
784 | 784 | } |
785 | 785 | |
786 | - $application->save(); |
|
786 | + $application->save (); |
|
787 | 787 | |
788 | 788 | // Redirect to correct page. |
789 | - switch ($request->input('submit')) { |
|
789 | + switch ($request->input ('submit')) { |
|
790 | 790 | case 'save_and_quit': |
791 | - return redirect()->route('applications.index'); |
|
791 | + return redirect ()->route ('applications.index'); |
|
792 | 792 | break; |
793 | 793 | case 'submit': |
794 | - return redirect()->route('job.application.complete', $jobPoster); |
|
794 | + return redirect ()->route ('job.application.complete', $jobPoster); |
|
795 | 795 | break; |
796 | 796 | case 'previous': |
797 | - return redirect()->route('job.application.edit.4', $jobPoster); |
|
797 | + return redirect ()->route ('job.application.edit.4', $jobPoster); |
|
798 | 798 | break; |
799 | 799 | default: |
800 | - return redirect()->back()->withInput(); |
|
800 | + return redirect ()->back ()->withInput (); |
|
801 | 801 | } |
802 | 802 | } |
803 | 803 | } |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | * @param \Illuminate\Http\Request $request Incoming request. |
20 | 20 | * @return \Illuminate\Http\Response |
21 | 21 | */ |
22 | - public function editAuthenticated(Request $request) |
|
22 | + public function editAuthenticated (Request $request) |
|
23 | 23 | { |
24 | - $applicant = $request->user()->applicant; |
|
25 | - return redirect(route('profile.skills.edit', $applicant)); |
|
24 | + $applicant = $request->user ()->applicant; |
|
25 | + return redirect (route ('profile.skills.edit', $applicant)); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -32,18 +32,18 @@ discard block |
||
32 | 32 | * @param \App\Models\Applicant $applicant Applicant object. |
33 | 33 | * @return \Illuminate\Http\Response |
34 | 34 | */ |
35 | - public function edit(Request $request, Applicant $applicant) |
|
35 | + public function edit (Request $request, Applicant $applicant) |
|
36 | 36 | { |
37 | - $applicant->load([ |
|
37 | + $applicant->load ([ |
|
38 | 38 | 'skill_declarations.skill.skill_type', |
39 | 39 | 'skill_declarations.skill_status', |
40 | 40 | 'skill_declarations.skill_level', |
41 | 41 | ]); |
42 | 42 | |
43 | - return view('applicant/profile_03_skills', [ |
|
43 | + return view ('applicant/profile_03_skills', [ |
|
44 | 44 | 'applicant' => $applicant, |
45 | - 'profile' => Lang::get('applicant/profile_skills'), |
|
46 | - 'skills_modals' => Lang::get('common/skills_modals'), |
|
45 | + 'profile' => Lang::get ('applicant/profile_skills'), |
|
46 | + 'skills_modals' => Lang::get ('common/skills_modals'), |
|
47 | 47 | ]); |
48 | 48 | } |
49 | 49 | |
@@ -53,25 +53,25 @@ discard block |
||
53 | 53 | * @param \Illuminate\Http\Request $request Incoming request. |
54 | 54 | * @return \Illuminate\Http\Response|string |
55 | 55 | */ |
56 | - public function create(Request $request) |
|
56 | + public function create (Request $request) |
|
57 | 57 | { |
58 | - $this->authorize('create', SkillDeclaration::class); |
|
58 | + $this->authorize ('create', SkillDeclaration::class); |
|
59 | 59 | |
60 | - $user = $request->user(); |
|
60 | + $user = $request->user (); |
|
61 | 61 | $applicant = $user->applicant; |
62 | 62 | |
63 | 63 | // Get the default claim status id. |
64 | - $claimedStatusId = SkillStatus::where('name', 'claimed')->firstOrFail()->id; |
|
64 | + $claimedStatusId = SkillStatus::where ('name', 'claimed')->firstOrFail ()->id; |
|
65 | 65 | |
66 | 66 | // Create a new Skill Declaration |
67 | 67 | // But don't save, as it hasn't been validated yet. |
68 | - $skillDeclaration = new SkillDeclaration(); |
|
68 | + $skillDeclaration = new SkillDeclaration (); |
|
69 | 69 | $skillDeclaration->applicant_id = $applicant->id; |
70 | - $skillDeclaration->skill_id = $request->input('skill_id'); |
|
70 | + $skillDeclaration->skill_id = $request->input ('skill_id'); |
|
71 | 71 | $skillDeclaration->skill_status_id = $claimedStatusId; |
72 | 72 | |
73 | 73 | // Update variable fields in skill declaration. |
74 | - return $this->updateSkillDeclaration($request, $skillDeclaration); |
|
74 | + return $this->updateSkillDeclaration ($request, $skillDeclaration); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | * @param \App\Models\SkillDeclaration $skillDeclaration Incoming Skill Declaration. |
82 | 82 | * @return \Illuminate\Http\Response|string |
83 | 83 | */ |
84 | - public function update(Request $request, SkillDeclaration $skillDeclaration) |
|
84 | + public function update (Request $request, SkillDeclaration $skillDeclaration) |
|
85 | 85 | { |
86 | - $this->authorize('update', $skillDeclaration); |
|
86 | + $this->authorize ('update', $skillDeclaration); |
|
87 | 87 | |
88 | - return $this->updateSkillDeclaration($request, $skillDeclaration); |
|
88 | + return $this->updateSkillDeclaration ($request, $skillDeclaration); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -95,38 +95,38 @@ discard block |
||
95 | 95 | * @param \App\Models\SkillDeclaration $skillDeclaration Incoming Skill Declaration. |
96 | 96 | * @return \Illuminate\Http\Response|string |
97 | 97 | */ |
98 | - protected function updateSkillDeclaration(Request $request, SkillDeclaration $skillDeclaration) |
|
98 | + protected function updateSkillDeclaration (Request $request, SkillDeclaration $skillDeclaration) |
|
99 | 99 | { |
100 | 100 | // Fill variable values. |
101 | - $skillDeclaration->fill([ |
|
102 | - 'description' => $request->input('description'), |
|
103 | - 'skill_level_id' => $request->input('skill_level_id'), |
|
101 | + $skillDeclaration->fill ([ |
|
102 | + 'description' => $request->input ('description'), |
|
103 | + 'skill_level_id' => $request->input ('skill_level_id'), |
|
104 | 104 | ]); |
105 | 105 | |
106 | 106 | // Validate before saving. |
107 | - $validator = new SkillDeclarationValidator($request->user()->applicant); |
|
108 | - $validator->validate($skillDeclaration); |
|
107 | + $validator = new SkillDeclarationValidator ($request->user ()->applicant); |
|
108 | + $validator->validate ($skillDeclaration); |
|
109 | 109 | |
110 | 110 | // Save this skill declaration. |
111 | - $skillDeclaration->save(); |
|
111 | + $skillDeclaration->save (); |
|
112 | 112 | |
113 | 113 | // Attach relatives. |
114 | - $referenceIds = $this->getRelativeIds($request->input(), 'references'); |
|
115 | - $skillDeclaration->references()->sync($referenceIds); |
|
114 | + $referenceIds = $this->getRelativeIds ($request->input (), 'references'); |
|
115 | + $skillDeclaration->references ()->sync ($referenceIds); |
|
116 | 116 | |
117 | - $sampleIds = $this->getRelativeIds($request->input(), 'samples'); |
|
118 | - $skillDeclaration->work_samples()->sync($sampleIds); |
|
117 | + $sampleIds = $this->getRelativeIds ($request->input (), 'samples'); |
|
118 | + $skillDeclaration->work_samples ()->sync ($sampleIds); |
|
119 | 119 | |
120 | 120 | // If an ajax request, return the new object. |
121 | - if ($request->ajax()) { |
|
122 | - $skillDeclaration->load('references'); |
|
123 | - $skillDeclaration->load('work_samples'); |
|
124 | - $skillDeclaration->load('skill'); |
|
125 | - $skillDeclaration->load('skill_status'); |
|
126 | - return $skillDeclaration->toJson(); |
|
121 | + if ($request->ajax ()) { |
|
122 | + $skillDeclaration->load ('references'); |
|
123 | + $skillDeclaration->load ('work_samples'); |
|
124 | + $skillDeclaration->load ('skill'); |
|
125 | + $skillDeclaration->load ('skill_status'); |
|
126 | + return $skillDeclaration->toJson (); |
|
127 | 127 | } |
128 | 128 | |
129 | - return redirect()->back(); |
|
129 | + return redirect ()->back (); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -136,15 +136,15 @@ discard block |
||
136 | 136 | * @param \App\Models\SkillDeclaration $skillDeclaration Incoming Skill Declaration. |
137 | 137 | * @return \Illuminate\Http\Response|string[] |
138 | 138 | */ |
139 | - public function destroy(Request $request, SkillDeclaration $skillDeclaration) |
|
139 | + public function destroy (Request $request, SkillDeclaration $skillDeclaration) |
|
140 | 140 | { |
141 | - $this->authorize('delete', $skillDeclaration); |
|
142 | - $skillDeclaration->delete(); |
|
141 | + $this->authorize ('delete', $skillDeclaration); |
|
142 | + $skillDeclaration->delete (); |
|
143 | 143 | |
144 | - if ($request->ajax()) { |
|
144 | + if ($request->ajax ()) { |
|
145 | 145 | return ['message' => 'Skill deleted']; |
146 | 146 | } |
147 | 147 | |
148 | - return redirect()->back(); |
|
148 | + return redirect ()->back (); |
|
149 | 149 | } |
150 | 150 | } |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | * @param \Illuminate\Http\Request $request Incoming request object. |
20 | 20 | * @return \Illuminate\Http\Response |
21 | 21 | */ |
22 | - public function editAuthenticated(Request $request) |
|
22 | + public function editAuthenticated (Request $request) |
|
23 | 23 | { |
24 | - $applicant = $request->user()->applicant; |
|
25 | - return redirect(route('profile.references.edit', $applicant)); |
|
24 | + $applicant = $request->user ()->applicant; |
|
25 | + return redirect (route ('profile.references.edit', $applicant)); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -32,16 +32,16 @@ discard block |
||
32 | 32 | * @param \App\Models\Applicant $applicant Incoming applicant object. |
33 | 33 | * @return \Illuminate\Http\Response |
34 | 34 | */ |
35 | - public function edit(Request $request, Applicant $applicant) |
|
35 | + public function edit (Request $request, Applicant $applicant) |
|
36 | 36 | { |
37 | - $applicant->load([ |
|
37 | + $applicant->load ([ |
|
38 | 38 | 'references.projects', |
39 | 39 | 'skill_declarations.skill', |
40 | 40 | ]); |
41 | 41 | |
42 | - return view('applicant/profile_04_references', [ |
|
42 | + return view ('applicant/profile_04_references', [ |
|
43 | 43 | 'applicant' => $applicant, |
44 | - 'profile' => Lang::get('applicant/profile_references'), |
|
44 | + 'profile' => Lang::get ('applicant/profile_references'), |
|
45 | 45 | ]); |
46 | 46 | } |
47 | 47 | |
@@ -52,56 +52,56 @@ discard block |
||
52 | 52 | * @param \App\Models\Reference|null $reference The reference to update. If null, a new one should be created. |
53 | 53 | * @return \Illuminate\Http\Response |
54 | 54 | */ |
55 | - public function update(Request $request, ?Reference $reference = null) |
|
55 | + public function update (Request $request, ?Reference $reference = null) |
|
56 | 56 | { |
57 | - $validator = new UpdateReferenceValidator(); |
|
58 | - $validator->validate($request->input()); |
|
57 | + $validator = new UpdateReferenceValidator (); |
|
58 | + $validator->validate ($request->input ()); |
|
59 | 59 | |
60 | 60 | if ($reference === null) { |
61 | - $reference = new Reference(); |
|
62 | - $reference->applicant_id = $request->user()->applicant->id; |
|
61 | + $reference = new Reference (); |
|
62 | + $reference->applicant_id = $request->user ()->applicant->id; |
|
63 | 63 | } |
64 | - $reference->fill([ |
|
65 | - 'name' => $request->input('name'), |
|
66 | - 'email' => $request->input('email'), |
|
67 | - 'relationship_id' => $request->input('relationship_id'), |
|
68 | - 'description' => $request->input('description'), |
|
64 | + $reference->fill ([ |
|
65 | + 'name' => $request->input ('name'), |
|
66 | + 'email' => $request->input ('email'), |
|
67 | + 'relationship_id' => $request->input ('relationship_id'), |
|
68 | + 'description' => $request->input ('description'), |
|
69 | 69 | ]); |
70 | - $reference->save(); |
|
70 | + $reference->save (); |
|
71 | 71 | |
72 | - $reference->load('projects'); |
|
72 | + $reference->load ('projects'); |
|
73 | 73 | |
74 | 74 | // TODO: As soon as you can interact with projects outside of references, |
75 | 75 | // this will become a dangerous operation. |
76 | - $reference->projects()->delete(); |
|
76 | + $reference->projects ()->delete (); |
|
77 | 77 | |
78 | 78 | $newProjects = []; |
79 | - if ($request->input('projects')) { |
|
80 | - foreach ($request->input('projects') as $projectInput) { |
|
81 | - $project = new Project(); |
|
79 | + if ($request->input ('projects')) { |
|
80 | + foreach ($request->input ('projects') as $projectInput) { |
|
81 | + $project = new Project (); |
|
82 | 82 | $project->applicant_id = $reference->applicant_id; |
83 | - $project->fill([ |
|
83 | + $project->fill ([ |
|
84 | 84 | 'name' => $projectInput['name'], |
85 | 85 | 'start_date' => $projectInput['start_date'], |
86 | 86 | 'end_date' => $projectInput['end_date'], |
87 | 87 | ]); |
88 | - $project->save(); |
|
88 | + $project->save (); |
|
89 | 89 | $newProjects[] = $project->id; |
90 | 90 | } |
91 | 91 | } |
92 | - $reference->projects()->sync($newProjects); |
|
92 | + $reference->projects ()->sync ($newProjects); |
|
93 | 93 | |
94 | 94 | // Attach relatives. |
95 | - $skillIds = $this->getRelativeIds($request->input(), 'skills'); |
|
96 | - $reference->skill_declarations()->sync($skillIds); |
|
95 | + $skillIds = $this->getRelativeIds ($request->input (), 'skills'); |
|
96 | + $reference->skill_declarations ()->sync ($skillIds); |
|
97 | 97 | |
98 | 98 | // If an ajax request, return the new object. |
99 | - if ($request->ajax()) { |
|
100 | - $reference->load('relationship'); |
|
101 | - $reference->load('projects'); |
|
102 | - return $reference->toJson(); |
|
99 | + if ($request->ajax ()) { |
|
100 | + $reference->load ('relationship'); |
|
101 | + $reference->load ('projects'); |
|
102 | + return $reference->toJson (); |
|
103 | 103 | } else { |
104 | - return redirect()->back(); |
|
104 | + return redirect ()->back (); |
|
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
@@ -112,21 +112,21 @@ discard block |
||
112 | 112 | * @param \App\Models\Reference $reference Incoming Reference. |
113 | 113 | * @return \Illuminate\Http\Response |
114 | 114 | */ |
115 | - public function destroy(Request $request, Reference $reference) |
|
115 | + public function destroy (Request $request, Reference $reference) |
|
116 | 116 | { |
117 | - $this->authorize('delete', $reference); |
|
117 | + $this->authorize ('delete', $reference); |
|
118 | 118 | |
119 | 119 | // TODO: when projects exist independently on profile, delete separately. |
120 | - $reference->projects()->delete(); |
|
120 | + $reference->projects ()->delete (); |
|
121 | 121 | |
122 | - $reference->delete(); |
|
122 | + $reference->delete (); |
|
123 | 123 | |
124 | - if ($request->ajax()) { |
|
124 | + if ($request->ajax ()) { |
|
125 | 125 | return [ |
126 | 126 | 'message' => 'Reference deleted' |
127 | 127 | ]; |
128 | 128 | } |
129 | 129 | |
130 | - return redirect()->back(); |
|
130 | + return redirect ()->back (); |
|
131 | 131 | } |
132 | 132 | } |
@@ -10,28 +10,28 @@ |
||
10 | 10 | protected $applicant; |
11 | 11 | protected $relationship_id; |
12 | 12 | |
13 | - public function __construct(Applicant $applicant) |
|
13 | + public function __construct (Applicant $applicant) |
|
14 | 14 | { |
15 | 15 | $this->applicant = $applicant; |
16 | - $this->relationship_id = Relationship::all()->pluck('id'); |
|
16 | + $this->relationship_id = Relationship::all ()->pluck ('id'); |
|
17 | 17 | } |
18 | - public function validate(ReferencesValidator $referencesValidator) |
|
18 | + public function validate (ReferencesValidator $referencesValidator) |
|
19 | 19 | { |
20 | - $uniqueSkillRule = new UniqueApplicantSkillRule($this->applicant, $referencesValidator->id); |
|
20 | + $uniqueSkillRule = new UniqueApplicantSkillRule ($this->applicant, $referencesValidator->id); |
|
21 | 21 | //This array is reset every time because applicants table can change frequently |
22 | - $applicant_ids = Applicant::all()->pluck('id'); |
|
22 | + $applicant_ids = Applicant::all ()->pluck ('id'); |
|
23 | 23 | //Validate basic data is filled in |
24 | - Validator::make($referencesValidator->getAttributes(), [ |
|
24 | + Validator::make ($referencesValidator->getAttributes (), [ |
|
25 | 25 | 'applicant_id' => [ |
26 | 26 | 'required', |
27 | - Rule::in($applicant_ids->toArray()), |
|
27 | + Rule::in ($applicant_ids->toArray ()), |
|
28 | 28 | ], |
29 | 29 | 'relatonship_id' => [ |
30 | 30 | 'required', |
31 | - Rule::in($this->relationship_id->toArray()), |
|
31 | + Rule::in ($this->relationship_id->toArray ()), |
|
32 | 32 | ] |
33 | 33 | |
34 | - ])->validate(); |
|
34 | + ])->validate (); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | } |
38 | 38 | \ No newline at end of file |
@@ -13,24 +13,24 @@ |
||
13 | 13 | |
14 | 14 | protected $applicant; |
15 | 15 | |
16 | - public function __construct(Applicant $applicant) |
|
16 | + public function __construct (Applicant $applicant) |
|
17 | 17 | { |
18 | 18 | $this->applicant = $applicant; |
19 | 19 | |
20 | 20 | } |
21 | - public function validate(WorkExperienceValidator $workExperienceValidator) |
|
21 | + public function validate (WorkExperienceValidator $workExperienceValidator) |
|
22 | 22 | { |
23 | - $uniqueSkillRule = new UniqueApplicantSkillRule($this->applicant, $workExperienceValidator->id); |
|
23 | + $uniqueSkillRule = new UniqueApplicantSkillRule ($this->applicant, $workExperienceValidator->id); |
|
24 | 24 | //This array is reset every time because applicants table can change frequently |
25 | - $applicant_ids = Applicant::all()->pluck('id'); |
|
25 | + $applicant_ids = Applicant::all ()->pluck ('id'); |
|
26 | 26 | //Validate basic data is filled in |
27 | - Validator::make($workExperienceValidator->getAttributes(), [ |
|
27 | + Validator::make ($workExperienceValidator->getAttributes (), [ |
|
28 | 28 | 'applicant_id' => [ |
29 | 29 | 'required', |
30 | - Rule::in($applicant_ids->toArray()), |
|
30 | + Rule::in ($applicant_ids->toArray ()), |
|
31 | 31 | ] |
32 | 32 | |
33 | - ])->validate(); |
|
33 | + ])->validate (); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | } |
37 | 37 | \ No newline at end of file |