@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | public function __construct() |
17 | 17 | { |
18 | 18 | // This applies the appropriate policy to each resource route. |
19 | - $this->authorizeResource(Manager::class, 'manager'); |
|
19 | + $this->authorizeResource (Manager::class, 'manager'); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function show(Manager $manager) |
50 | 50 | { |
51 | - return response()->json($manager->toApiArray()); |
|
51 | + return response ()->json ($manager->toApiArray ()); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function showAuthenticated() |
60 | 60 | { |
61 | - $user = Auth::user(); |
|
61 | + $user = Auth::user (); |
|
62 | 62 | if ($user !== null && $user->manager !== null) { |
63 | - return response()->json($user->manager->toApiArray()); |
|
63 | + return response ()->json ($user->manager->toApiArray ()); |
|
64 | 64 | } |
65 | - return response()->json([]); |
|
65 | + return response ()->json ([]); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function update(UpdateManagerApi $request, Manager $manager) |
76 | 76 | { |
77 | - $validated = $request->validated(); |
|
78 | - $manager->fill($validated); |
|
79 | - $manager->save(); |
|
80 | - return response()->json($manager->toApiArray()); |
|
77 | + $validated = $request->validated (); |
|
78 | + $manager->fill ($validated); |
|
79 | + $manager->save (); |
|
80 | + return response ()->json ($manager->toApiArray ()); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -16,15 +16,15 @@ |
||
16 | 16 | */ |
17 | 17 | public function destroy(Request $request, Degree $degree) |
18 | 18 | { |
19 | - $this->authorize('delete', $degree); |
|
20 | - $degree->delete(); |
|
19 | + $this->authorize ('delete', $degree); |
|
20 | + $degree->delete (); |
|
21 | 21 | |
22 | - if ($request->ajax()) { |
|
22 | + if ($request->ajax ()) { |
|
23 | 23 | return [ |
24 | 24 | 'message' => 'Degree deleted', |
25 | 25 | ]; |
26 | 26 | } |
27 | 27 | |
28 | - return back(); |
|
28 | + return back (); |
|
29 | 29 | } |
30 | 30 | } |
@@ -41,11 +41,11 @@ discard block |
||
41 | 41 | * description // Question description text |
42 | 42 | */ |
43 | 43 | |
44 | - return view( |
|
44 | + return view ( |
|
45 | 45 | 'manager/applicant_profile', |
46 | 46 | [ |
47 | 47 | // Localization Strings. |
48 | - 'profile' => Lang::get('manager/applicant_profile'), // Change text |
|
48 | + 'profile' => Lang::get ('manager/applicant_profile'), // Change text |
|
49 | 49 | // User Data. |
50 | 50 | 'user' => $applicant->user, |
51 | 51 | 'applicant' => $applicant, |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function editAuthenticated(Request $request) |
64 | 64 | { |
65 | - $applicant = $request->user()->applicant; |
|
66 | - return redirect(route('profile.about.edit', $applicant)); |
|
65 | + $applicant = $request->user ()->applicant; |
|
66 | + return redirect (route ('profile.about.edit', $applicant)); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -75,14 +75,14 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function edit(Request $request, Applicant $applicant) |
77 | 77 | { |
78 | - $profileQuestions = ApplicantProfileQuestion::all(); |
|
78 | + $profileQuestions = ApplicantProfileQuestion::all (); |
|
79 | 79 | |
80 | - $profileText = Lang::get('applicant/applicant_profile'); |
|
80 | + $profileText = Lang::get ('applicant/applicant_profile'); |
|
81 | 81 | |
82 | 82 | $profileQuestionForms = []; |
83 | 83 | foreach ($profileQuestions as $question) { |
84 | 84 | $answerObj = $applicant->applicant_profile_answers |
85 | - ->where('applicant_profile_question_id', $question->id)->first(); |
|
85 | + ->where ('applicant_profile_question_id', $question->id)->first (); |
|
86 | 86 | $answer = $answerObj ? $answerObj->answer : null; |
87 | 87 | |
88 | 88 | $formValues = [ |
@@ -93,13 +93,13 @@ discard block |
||
93 | 93 | 'answer_label' => $profileText['about_section']['answer_label'], |
94 | 94 | 'input_name' => $this->answerFormInputName.'['.$question->id.']' |
95 | 95 | ]; |
96 | - array_push($profileQuestionForms, $formValues); |
|
96 | + array_push ($profileQuestionForms, $formValues); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | $linkedInUrlPattern = LinkedInUrlRule::PATTERN; |
100 | 100 | $twitterHandlePattern = TwitterHandleRule::PATTERN; |
101 | 101 | |
102 | - return view( |
|
102 | + return view ( |
|
103 | 103 | 'applicant/profile_01_about', |
104 | 104 | [ |
105 | 105 | // Localized strings. |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | 'user' => $applicant->user, |
111 | 111 | 'applicant' => $applicant, |
112 | 112 | 'profile_photo_url' => '/images/user.png', // TODO: get real photos. |
113 | - 'form_submit_action' => route('profile.about.update', $applicant), |
|
113 | + 'form_submit_action' => route ('profile.about.update', $applicant), |
|
114 | 114 | 'linkedInUrlPattern' => $linkedInUrlPattern, |
115 | 115 | 'twitterHandlePattern' => $twitterHandlePattern, |
116 | 116 | ] |
@@ -126,42 +126,42 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function update(Request $request, Applicant $applicant) |
128 | 128 | { |
129 | - $questions = ApplicantProfileQuestion::all(); |
|
129 | + $questions = ApplicantProfileQuestion::all (); |
|
130 | 130 | |
131 | - $validator = new UpdateApplicationProfileValidator($applicant); |
|
132 | - $validator->validate($request->all()); |
|
131 | + $validator = new UpdateApplicationProfileValidator ($applicant); |
|
132 | + $validator->validate ($request->all ()); |
|
133 | 133 | |
134 | 134 | foreach ($questions as $question) { |
135 | - $answerName = $this->answerFormInputName . '.' . $question->id; |
|
136 | - if ($request->has($answerName)) { |
|
137 | - $answer = ApplicantProfileAnswer::where( |
|
135 | + $answerName = $this->answerFormInputName.'.'.$question->id; |
|
136 | + if ($request->has ($answerName)) { |
|
137 | + $answer = ApplicantProfileAnswer::where ( |
|
138 | 138 | [ |
139 | 139 | 'applicant_id' => $applicant->id, |
140 | 140 | 'applicant_profile_question_id' => $question->id |
141 | 141 | ] |
142 | - )->first(); |
|
142 | + )->first (); |
|
143 | 143 | if ($answer == null) { |
144 | - $answer = new ApplicantProfileAnswer(); |
|
145 | - $answer->applicant_id =$applicant->id; |
|
144 | + $answer = new ApplicantProfileAnswer (); |
|
145 | + $answer->applicant_id = $applicant->id; |
|
146 | 146 | $answer->applicant_profile_question_id = $question->id; |
147 | 147 | } |
148 | - $answer->answer = $request->input($answerName); |
|
149 | - $answer->save(); |
|
148 | + $answer->answer = $request->input ($answerName); |
|
149 | + $answer->save (); |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | |
153 | - $input = $request->input(); |
|
154 | - $applicant->fill( |
|
153 | + $input = $request->input (); |
|
154 | + $applicant->fill ( |
|
155 | 155 | [ |
156 | 156 | 'tagline' => $input['tagline'], |
157 | 157 | 'twitter_username' => $input['twitter_username'], |
158 | 158 | 'linkedin_url' => $input['linkedin_url'], |
159 | 159 | ] |
160 | 160 | ); |
161 | - $applicant->save(); |
|
161 | + $applicant->save (); |
|
162 | 162 | |
163 | 163 | $user = $applicant->user; |
164 | - $user->fill( |
|
164 | + $user->fill ( |
|
165 | 165 | [ |
166 | 166 | 'first_name' => $input['profile_first_name'], |
167 | 167 | 'last_name' => $input['profile_last_name'], |
@@ -169,10 +169,10 @@ discard block |
||
169 | 169 | ] |
170 | 170 | ); |
171 | 171 | if ($input['new_password']) { |
172 | - $user->password = Hash::make($input['new_password']); // TODO: change password in seperate form! |
|
172 | + $user->password = Hash::make ($input['new_password']); // TODO: change password in seperate form! |
|
173 | 173 | } |
174 | - $user->save(); |
|
174 | + $user->save (); |
|
175 | 175 | |
176 | - return redirect()->route('profile.about.edit', $applicant); |
|
176 | + return redirect ()->route ('profile.about.edit', $applicant); |
|
177 | 177 | } |
178 | 178 | } |
@@ -17,12 +17,12 @@ discard block |
||
17 | 17 | public function index(Request $request) |
18 | 18 | { |
19 | 19 | $notificationsArray = []; |
20 | - if ($request->has('job_poster_id') && $request->user() != null) { |
|
21 | - $jobPosterId = $request->input('job_poster_id'); |
|
22 | - $notifications = AssessmentPlanNotification::where('job_poster_id', $jobPosterId)->get(); |
|
20 | + if ($request->has ('job_poster_id') && $request->user () != null) { |
|
21 | + $jobPosterId = $request->input ('job_poster_id'); |
|
22 | + $notifications = AssessmentPlanNotification::where ('job_poster_id', $jobPosterId)->get (); |
|
23 | 23 | foreach ($notifications as $notification) { |
24 | - if ($request->user()->can('view', $notification)) { |
|
25 | - $notificationsArray[] = $notification->toArray(); |
|
24 | + if ($request->user ()->can ('view', $notification)) { |
|
25 | + $notificationsArray[] = $notification->toArray (); |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | } |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function show(AssessmentPlanNotification $assessmentPlanNotification) |
39 | 39 | { |
40 | - $this->authorize('view', $assessmentPlanNotification); |
|
41 | - return $assessmentPlanNotification->toArray(); |
|
40 | + $this->authorize ('view', $assessmentPlanNotification); |
|
41 | + return $assessmentPlanNotification->toArray (); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -51,15 +51,15 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function update(Request $request, AssessmentPlanNotification $assessmentPlanNotification) |
53 | 53 | { |
54 | - $this->authorize('update', $assessmentPlanNotification); |
|
55 | - $assessmentPlanNotification->fill([ |
|
56 | - 'acknowledged' => $request->input('acknowledged') |
|
54 | + $this->authorize ('update', $assessmentPlanNotification); |
|
55 | + $assessmentPlanNotification->fill ([ |
|
56 | + 'acknowledged' => $request->input ('acknowledged') |
|
57 | 57 | ]); |
58 | - $assessmentPlanNotification->save(); |
|
58 | + $assessmentPlanNotification->save (); |
|
59 | 59 | |
60 | 60 | return [ |
61 | 61 | 'success' => "Successfully updated assessment plan notification $assessmentPlanNotification->id", |
62 | - 'assessment_plan_notification' => $assessmentPlanNotification->toArray(), |
|
62 | + 'assessment_plan_notification' => $assessmentPlanNotification->toArray (), |
|
63 | 63 | ]; |
64 | 64 | } |
65 | 65 | |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function destroy(AssessmentPlanNotification $assessmentPlanNotification) |
73 | 73 | { |
74 | - $this->authorize('delete', $assessmentPlanNotification); |
|
75 | - $assessmentPlanNotification->delete(); |
|
74 | + $this->authorize ('delete', $assessmentPlanNotification); |
|
75 | + $assessmentPlanNotification->delete (); |
|
76 | 76 | |
77 | 77 | return [ |
78 | 78 | 'success' => "Successfully deleted assessment plan notification $assessmentPlanNotification->id" |
@@ -14,10 +14,10 @@ |
||
14 | 14 | */ |
15 | 15 | public function show() |
16 | 16 | { |
17 | - return view( |
|
17 | + return view ( |
|
18 | 18 | 'manager/job-builder-root' |
19 | - )->with([ |
|
20 | - 'title' => Lang::get('manager/job_builder.title'), |
|
19 | + )->with ([ |
|
20 | + 'title' => Lang::get ('manager/job_builder.title'), |
|
21 | 21 | ]); |
22 | 22 | } |
23 | 23 | } |
@@ -16,15 +16,15 @@ |
||
16 | 16 | */ |
17 | 17 | public function destroy(Request $request, WorkExperience $workExperience) |
18 | 18 | { |
19 | - $this->authorize('delete', $workExperience); |
|
20 | - $workExperience->delete(); |
|
19 | + $this->authorize ('delete', $workExperience); |
|
20 | + $workExperience->delete (); |
|
21 | 21 | |
22 | - if ($request->ajax()) { |
|
22 | + if ($request->ajax ()) { |
|
23 | 23 | return [ |
24 | 24 | 'message' => 'Work Experience delete', |
25 | 25 | ]; |
26 | 26 | } |
27 | 27 | |
28 | - return back(); |
|
28 | + return back (); |
|
29 | 29 | } |
30 | 30 | } |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | */ |
22 | 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 | /** |
@@ -34,14 +34,14 @@ discard block |
||
34 | 34 | */ |
35 | 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 | |
@@ -54,54 +54,54 @@ discard block |
||
54 | 54 | */ |
55 | 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 | |
@@ -114,19 +114,19 @@ discard block |
||
114 | 114 | */ |
115 | 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 | } |
@@ -15,27 +15,27 @@ discard block |
||
15 | 15 | */ |
16 | 16 | public function applicant() |
17 | 17 | { |
18 | - $now = Carbon::now(); |
|
18 | + $now = Carbon::now (); |
|
19 | 19 | |
20 | 20 | // Find three most recent published jobs that are currently open for applications. |
21 | 21 | // Eager load required relationships: Department, Province, JobTerm. |
22 | - $jobs = JobPoster::where('open_date_time', '<=', $now) |
|
23 | - ->where('close_date_time', '>=', $now) |
|
24 | - ->where('published', true) |
|
25 | - ->with([ |
|
22 | + $jobs = JobPoster::where ('open_date_time', '<=', $now) |
|
23 | + ->where ('close_date_time', '>=', $now) |
|
24 | + ->where ('published', true) |
|
25 | + ->with ([ |
|
26 | 26 | 'department', |
27 | 27 | 'province', |
28 | 28 | ]) |
29 | - ->orderBy('open_date_time', 'desc') |
|
30 | - ->take(3) |
|
31 | - ->get(); |
|
32 | - return view('applicant/home', [ |
|
33 | - 'home' => Lang::get('applicant/home'), |
|
34 | - 'hero' => Lang::get('common/hero'), |
|
35 | - 'job_index' => Lang::get('applicant/job_index'), |
|
36 | - 'job_post' => Lang::get('applicant/job_post'), |
|
29 | + ->orderBy ('open_date_time', 'desc') |
|
30 | + ->take (3) |
|
31 | + ->get (); |
|
32 | + return view ('applicant/home', [ |
|
33 | + 'home' => Lang::get ('applicant/home'), |
|
34 | + 'hero' => Lang::get ('common/hero'), |
|
35 | + 'job_index' => Lang::get ('applicant/job_index'), |
|
36 | + 'job_post' => Lang::get ('applicant/job_post'), |
|
37 | 37 | 'jobs' => $jobs, |
38 | - 'job_count' => count($jobs) |
|
38 | + 'job_count' => count ($jobs) |
|
39 | 39 | ]); |
40 | 40 | } |
41 | 41 | |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function manager() |
47 | 47 | { |
48 | - return view('manager/home', [ |
|
49 | - 'home_l10n' => Lang::get('manager/home'), |
|
48 | + return view ('manager/home', [ |
|
49 | + 'home_l10n' => Lang::get ('manager/home'), |
|
50 | 50 | ]); |
51 | 51 | } |
52 | 52 | } |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | */ |
22 | 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 | /** |
@@ -34,16 +34,16 @@ discard block |
||
34 | 34 | */ |
35 | 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 | |
@@ -55,23 +55,23 @@ discard block |
||
55 | 55 | */ |
56 | 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 | /** |
@@ -83,9 +83,9 @@ discard block |
||
83 | 83 | */ |
84 | 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 | /** |
@@ -98,35 +98,35 @@ discard block |
||
98 | 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 | /** |
@@ -138,13 +138,13 @@ discard block |
||
138 | 138 | */ |
139 | 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 | } |