@@ -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 | } |
@@ -27,20 +27,20 @@ discard block |
||
27 | 27 | |
28 | 28 | public function shiftFirstLevelArrayKeysToBottom(array $nestedArray) |
29 | 29 | { |
30 | - $expandedArray = $this->expandNestedArraysIntoKeyListAndValue($nestedArray); |
|
31 | - $rotatedArray = $this->rotateKeys($expandedArray, 1); |
|
32 | - $mergedArray = $this->mergeExpandedTrees($rotatedArray); |
|
30 | + $expandedArray = $this->expandNestedArraysIntoKeyListAndValue ($nestedArray); |
|
31 | + $rotatedArray = $this->rotateKeys ($expandedArray, 1); |
|
32 | + $mergedArray = $this->mergeExpandedTrees ($rotatedArray); |
|
33 | 33 | return $mergedArray; |
34 | 34 | } |
35 | 35 | |
36 | 36 | protected function addKeyAsFinalIndex($finalKey, $array) |
37 | 37 | { |
38 | - if (!is_array($array)) { |
|
38 | + if (!is_array ($array)) { |
|
39 | 39 | return [$finalKey => $array]; |
40 | 40 | } else { |
41 | 41 | $newArray = []; |
42 | 42 | foreach ($array as $key => $value) { |
43 | - $newArray[$key] = $this->addKeyAsFinalIndex($finalKey, $value); |
|
43 | + $newArray[$key] = $this->addKeyAsFinalIndex ($finalKey, $value); |
|
44 | 44 | } |
45 | 45 | return $newArray; |
46 | 46 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | protected function expandNestedArraysIntoKeyListAndValue($nestedArray) |
50 | 50 | { |
51 | - if (!is_array($nestedArray)) { |
|
51 | + if (!is_array ($nestedArray)) { |
|
52 | 52 | $expandedArray = [ |
53 | 53 | [ |
54 | 54 | 'keys' => [], |
@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | } else { |
60 | 60 | $expandedArray = []; |
61 | 61 | foreach ($nestedArray as $key => $value) { |
62 | - $subArray = $this->expandNestedArraysIntoKeyListAndValue($value); |
|
62 | + $subArray = $this->expandNestedArraysIntoKeyListAndValue ($value); |
|
63 | 63 | foreach ($subArray as $item) { |
64 | - array_unshift($item['keys'], $key); |
|
64 | + array_unshift ($item['keys'], $key); |
|
65 | 65 | $expandedArray[] = $item; |
66 | 66 | } |
67 | 67 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $mergedArray = []; |
75 | 75 | foreach ($expandedArray as $item) { |
76 | 76 | $tail = &$mergedArray; |
77 | - $size = count($item['keys']); |
|
77 | + $size = count ($item['keys']); |
|
78 | 78 | $i = 0; |
79 | 79 | foreach ($item['keys'] as $key) { |
80 | 80 | $i = ($i + 1); |
@@ -82,17 +82,17 @@ discard block |
||
82 | 82 | if ($i == ($size)) { |
83 | 83 | if (!isset($tail[$key])) { |
84 | 84 | $tail[$key] = $item['value']; |
85 | - } elseif (!is_array($tail[$key])) { |
|
85 | + } elseif (!is_array ($tail[$key])) { |
|
86 | 86 | $value = $tail[$key]; |
87 | 87 | $tail[$key] = [$value, $item['value']]; |
88 | 88 | } else { |
89 | - array_push($tail[$key], $item['value']); |
|
89 | + array_push ($tail[$key], $item['value']); |
|
90 | 90 | } |
91 | 91 | } else { |
92 | 92 | // If this is not the last key, it needs to contain an array. |
93 | 93 | if (!isset($tail[$key])) { |
94 | 94 | $tail[$key] = []; |
95 | - } elseif (!is_array($tail[$key])) { |
|
95 | + } elseif (!is_array ($tail[$key])) { |
|
96 | 96 | $value = $tail[$key]; |
97 | 97 | $tail[$key] = [$value]; |
98 | 98 | } |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | { |
108 | 108 | $rotatedArray = []; |
109 | 109 | foreach ($expandedArray as $item) { |
110 | - for ($i=0; $i<$steps; $i++) { |
|
111 | - array_push($item['keys'], array_shift($item['keys'])); |
|
110 | + for ($i = 0; $i < $steps; $i++) { |
|
111 | + array_push ($item['keys'], array_shift ($item['keys'])); |
|
112 | 112 | } |
113 | 113 | $rotatedArray[] = $item; |
114 | 114 | } |
@@ -123,6 +123,6 @@ discard block |
||
123 | 123 | */ |
124 | 124 | protected function formatAjaxResponse(array $content) |
125 | 125 | { |
126 | - return response()->json($content); |
|
126 | + return response ()->json ($content); |
|
127 | 127 | } |
128 | 128 | } |
@@ -14,11 +14,11 @@ |
||
14 | 14 | */ |
15 | 15 | public function __invoke() |
16 | 16 | { |
17 | - return view( |
|
17 | + return view ( |
|
18 | 18 | 'applicant/static_faq', |
19 | 19 | [ |
20 | - 'faq' => Lang::get('applicant/faq'), |
|
21 | - 'breadcrumb_home' => route('home'), |
|
20 | + 'faq' => Lang::get ('applicant/faq'), |
|
21 | + 'breadcrumb_home' => route ('home'), |
|
22 | 22 | 'applicant_sidebar_active' => 'active', |
23 | 23 | ] |
24 | 24 | ); |
@@ -19,29 +19,29 @@ discard block |
||
19 | 19 | */ |
20 | 20 | public function store(Request $request) |
21 | 21 | { |
22 | - $this->authorize('create', RatingGuideQuestion::class); |
|
22 | + $this->authorize ('create', RatingGuideQuestion::class); |
|
23 | 23 | |
24 | - $job_poster_id = (int)$request->json('job_poster_id'); |
|
25 | - $assessment_type_id = (int)$request->json('assessment_type_id'); |
|
26 | - $question = $request->json('question'); |
|
24 | + $job_poster_id = (int) $request->json ('job_poster_id'); |
|
25 | + $assessment_type_id = (int) $request->json ('assessment_type_id'); |
|
26 | + $question = $request->json ('question'); |
|
27 | 27 | |
28 | - JobPoster::findOrFail($job_poster_id); |
|
29 | - AssessmentType::findOrFail($assessment_type_id); |
|
28 | + JobPoster::findOrFail ($job_poster_id); |
|
29 | + AssessmentType::findOrFail ($assessment_type_id); |
|
30 | 30 | |
31 | - $ratingGuideQuestion = new RatingGuideQuestion([ |
|
31 | + $ratingGuideQuestion = new RatingGuideQuestion ([ |
|
32 | 32 | 'job_poster_id' => $job_poster_id, |
33 | 33 | 'assessment_type_id' => $assessment_type_id, |
34 | 34 | 'question' => $question, |
35 | 35 | ]); |
36 | 36 | // Check that this user is allowed to create an Assessment for this criterion. |
37 | - $this->authorize('update', $ratingGuideQuestion); |
|
37 | + $this->authorize ('update', $ratingGuideQuestion); |
|
38 | 38 | |
39 | - $ratingGuideQuestion->save(); |
|
40 | - $ratingGuideQuestion->refresh(); |
|
39 | + $ratingGuideQuestion->save (); |
|
40 | + $ratingGuideQuestion->refresh (); |
|
41 | 41 | |
42 | 42 | return [ |
43 | 43 | 'success' => "Successfully created rating guide question $ratingGuideQuestion->id", |
44 | - 'rating_guide_question' => $ratingGuideQuestion->toArray(), |
|
44 | + 'rating_guide_question' => $ratingGuideQuestion->toArray (), |
|
45 | 45 | ]; |
46 | 46 | } |
47 | 47 | |
@@ -53,12 +53,12 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function show(RatingGuideQuestion $ratingGuideQuestion) |
55 | 55 | { |
56 | - $this->authorize('view', $ratingGuideQuestion); |
|
57 | - $ratingGuideQuestion->load([ |
|
56 | + $this->authorize ('view', $ratingGuideQuestion); |
|
57 | + $ratingGuideQuestion->load ([ |
|
58 | 58 | 'job_poster', |
59 | 59 | 'assessment_type' |
60 | 60 | ]); |
61 | - return $ratingGuideQuestion->toArray(); |
|
61 | + return $ratingGuideQuestion->toArray (); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -71,23 +71,23 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function update(Request $request, RatingGuideQuestion $ratingGuideQuestion) |
73 | 73 | { |
74 | - $this->authorize('update', $ratingGuideQuestion); |
|
74 | + $this->authorize ('update', $ratingGuideQuestion); |
|
75 | 75 | |
76 | - $job_poster_id = (int)$request->json('job_poster_id'); |
|
77 | - $assessment_type_id = (int)$request->json('assessment_type_id'); |
|
78 | - $question = $request->json('question'); |
|
76 | + $job_poster_id = (int) $request->json ('job_poster_id'); |
|
77 | + $assessment_type_id = (int) $request->json ('assessment_type_id'); |
|
78 | + $question = $request->json ('question'); |
|
79 | 79 | |
80 | - JobPoster::findOrFail($job_poster_id); |
|
81 | - AssessmentType::findOrFail($assessment_type_id); |
|
80 | + JobPoster::findOrFail ($job_poster_id); |
|
81 | + AssessmentType::findOrFail ($assessment_type_id); |
|
82 | 82 | |
83 | 83 | $ratingGuideQuestion->job_poster_id = $job_poster_id; |
84 | 84 | $ratingGuideQuestion->assessment_type_id = $assessment_type_id; |
85 | 85 | $ratingGuideQuestion->question = $question; |
86 | - $ratingGuideQuestion->save(); |
|
86 | + $ratingGuideQuestion->save (); |
|
87 | 87 | |
88 | 88 | return [ |
89 | 89 | 'success' => "Successfully updated rating guide question $ratingGuideQuestion->id", |
90 | - 'rating_guide_question' => $ratingGuideQuestion->toArray(), |
|
90 | + 'rating_guide_question' => $ratingGuideQuestion->toArray (), |
|
91 | 91 | ]; |
92 | 92 | } |
93 | 93 | |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function destroy(RatingGuideQuestion $ratingGuideQuestion) |
101 | 101 | { |
102 | - $this->authorize('delete', $ratingGuideQuestion); |
|
103 | - $ratingGuideQuestion->delete(); |
|
102 | + $this->authorize ('delete', $ratingGuideQuestion); |
|
103 | + $ratingGuideQuestion->delete (); |
|
104 | 104 | |
105 | 105 | return [ |
106 | 106 | 'success' => "Successfully deleted rating guide question $ratingGuideQuestion->id" |
@@ -19,29 +19,29 @@ |
||
19 | 19 | */ |
20 | 20 | public function updateForApplication(Request $request, JobApplication $application) |
21 | 21 | { |
22 | - $request->validate([ |
|
22 | + $request->validate ([ |
|
23 | 23 | 'review_status_id' => [ |
24 | 24 | 'nullable', |
25 | - Rule::in(ReviewStatus::all()->pluck('id')->toArray()) |
|
25 | + Rule::in (ReviewStatus::all ()->pluck ('id')->toArray ()) |
|
26 | 26 | ], |
27 | 27 | 'notes' => 'nullable|string' |
28 | 28 | ]); |
29 | 29 | |
30 | 30 | $review = $application->application_review; |
31 | 31 | if ($review === null) { |
32 | - $review = new ApplicationReview(); |
|
33 | - $review->job_application()->associate($application); |
|
32 | + $review = new ApplicationReview (); |
|
33 | + $review->job_application ()->associate ($application); |
|
34 | 34 | } |
35 | - $review->fill([ |
|
36 | - 'review_status_id' => $request->input('review_status_id'), |
|
37 | - 'notes' => $request->input('notes'), |
|
35 | + $review->fill ([ |
|
36 | + 'review_status_id' => $request->input ('review_status_id'), |
|
37 | + 'notes' => $request->input ('notes'), |
|
38 | 38 | ]); |
39 | - $review->save(); |
|
39 | + $review->save (); |
|
40 | 40 | |
41 | - if ($request->ajax()) { |
|
42 | - return $review->fresh()->toJson(); |
|
41 | + if ($request->ajax ()) { |
|
42 | + return $review->fresh ()->toJson (); |
|
43 | 43 | } |
44 | 44 | |
45 | - return redirect()->back(); |
|
45 | + return redirect ()->back (); |
|
46 | 46 | } |
47 | 47 | } |
@@ -18,33 +18,33 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function store(Request $request) |
20 | 20 | { |
21 | - $this->authorize('create', Assessment::class); |
|
21 | + $this->authorize ('create', Assessment::class); |
|
22 | 22 | |
23 | 23 | try { |
24 | - $criterion_id = (int)$request->json('criterion_id'); |
|
25 | - $assessment_type_id = (int)$request->json('assessment_type_id'); |
|
26 | - $criteria = Criteria::findOrFail($criterion_id); |
|
27 | - AssessmentType::findOrFail($assessment_type_id); |
|
24 | + $criterion_id = (int) $request->json ('criterion_id'); |
|
25 | + $assessment_type_id = (int) $request->json ('assessment_type_id'); |
|
26 | + $criteria = Criteria::findOrFail ($criterion_id); |
|
27 | + AssessmentType::findOrFail ($assessment_type_id); |
|
28 | 28 | |
29 | - $assessment = new Assessment([ |
|
29 | + $assessment = new Assessment ([ |
|
30 | 30 | 'criterion_id' => $criterion_id, |
31 | 31 | 'assessment_type_id' => $assessment_type_id |
32 | 32 | ]); |
33 | 33 | // Check that this user is allowed to create an Assessment for this criterion. |
34 | - $this->authorize('update', $assessment); |
|
34 | + $this->authorize ('update', $assessment); |
|
35 | 35 | |
36 | - $assessment->save(); |
|
37 | - $assessment->refresh(); |
|
38 | - $assessment['criteria'] = $criteria->toArray(); |
|
36 | + $assessment->save (); |
|
37 | + $assessment->refresh (); |
|
38 | + $assessment['criteria'] = $criteria->toArray (); |
|
39 | 39 | } catch (\Exception $e) { |
40 | - return response()->json([ |
|
41 | - 'error' => $e->getMessage() |
|
40 | + return response ()->json ([ |
|
41 | + 'error' => $e->getMessage () |
|
42 | 42 | ], 400); |
43 | 43 | } |
44 | 44 | |
45 | 45 | return [ |
46 | 46 | 'success' => "Successfully created assessment $assessment->id", |
47 | - 'assessment' => $assessment->toArray() |
|
47 | + 'assessment' => $assessment->toArray () |
|
48 | 48 | ]; |
49 | 49 | } |
50 | 50 | |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function show(Assessment $assessment) |
58 | 58 | { |
59 | - $this->authorize('view', $assessment); |
|
60 | - $criteria = Criteria::find($assessment->id); |
|
61 | - $assessment['criteria'] = $criteria->toArray(); |
|
62 | - return $assessment->toArray(); |
|
59 | + $this->authorize ('view', $assessment); |
|
60 | + $criteria = Criteria::find ($assessment->id); |
|
61 | + $assessment['criteria'] = $criteria->toArray (); |
|
62 | + return $assessment->toArray (); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -71,26 +71,26 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function update(Request $request, Assessment $assessment) |
73 | 73 | { |
74 | - $this->authorize('update', $assessment); |
|
74 | + $this->authorize ('update', $assessment); |
|
75 | 75 | try { |
76 | - $criterion_id = (int)$request->json('criterion_id'); |
|
77 | - $assessment_type_id = (int)$request->json('assessment_type_id'); |
|
78 | - $criteria = Criteria::findOrFail($criterion_id); |
|
79 | - AssessmentType::findOrFail($assessment_type_id); |
|
76 | + $criterion_id = (int) $request->json ('criterion_id'); |
|
77 | + $assessment_type_id = (int) $request->json ('assessment_type_id'); |
|
78 | + $criteria = Criteria::findOrFail ($criterion_id); |
|
79 | + AssessmentType::findOrFail ($assessment_type_id); |
|
80 | 80 | |
81 | 81 | $assessment->criterion_id = $criterion_id; |
82 | 82 | $assessment->assessment_type_id = $assessment_type_id; |
83 | - $assessment->save(); |
|
84 | - $assessment['criteria'] = $criteria->toArray(); |
|
83 | + $assessment->save (); |
|
84 | + $assessment['criteria'] = $criteria->toArray (); |
|
85 | 85 | } catch (\Exception $e) { |
86 | - return response()->json([ |
|
87 | - 'error' => $e->getMessage() |
|
86 | + return response ()->json ([ |
|
87 | + 'error' => $e->getMessage () |
|
88 | 88 | ], 400); |
89 | 89 | } |
90 | 90 | |
91 | 91 | return [ |
92 | 92 | 'success' => "Successfully updated assessment $assessment->id", |
93 | - 'assessment' => $assessment->toArray(), |
|
93 | + 'assessment' => $assessment->toArray (), |
|
94 | 94 | ]; |
95 | 95 | } |
96 | 96 | |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function destroy(Assessment $assessment) |
104 | 104 | { |
105 | - $this->authorize('delete', $assessment); |
|
106 | - $assessment->delete(); |
|
105 | + $this->authorize ('delete', $assessment); |
|
106 | + $assessment->delete (); |
|
107 | 107 | |
108 | 108 | return [ |
109 | 109 | 'success' => "Successfully deleted assessment $assessment->id" |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | protected function redirectTo() |
46 | 46 | { |
47 | - $redirectTo = WhichPortal::isManagerPortal() ? route('manager.home') : route('home'); |
|
47 | + $redirectTo = WhichPortal::isManagerPortal () ? route('manager.home') : route ('home'); |
|
48 | 48 | return $redirectTo; |
49 | 49 | } |
50 | 50 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function __construct() |
57 | 57 | { |
58 | - $this->middleware('guest')->except('logout'); |
|
58 | + $this->middleware ('guest')->except ('logout'); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function showLoginForm() |
68 | 68 | { |
69 | - $home_url = WhichPortal::isManagerPortal() ? route('manager.home') : route('home'); |
|
69 | + $home_url = WhichPortal::isManagerPortal () ? route('manager.home') : route ('home'); |
|
70 | 70 | |
71 | - return view('auth/login', [ |
|
72 | - 'routes' => $this->auth_routes(), |
|
73 | - 'login' => Lang::get('common/auth/login'), |
|
71 | + return view ('auth/login', [ |
|
72 | + 'routes' => $this->auth_routes (), |
|
73 | + 'login' => Lang::get ('common/auth/login'), |
|
74 | 74 | 'home_url' => $home_url, |
75 | 75 | ]); |
76 | 76 | } |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function logout(Request $request) |
86 | 86 | { |
87 | - $this->guard()->logout(); |
|
87 | + $this->guard ()->logout (); |
|
88 | 88 | |
89 | - $request->session()->invalidate(); |
|
89 | + $request->session ()->invalidate (); |
|
90 | 90 | |
91 | 91 | // This causes logout to redirect to the same page as login. |
92 | - return redirect($this->redirectPath()); |
|
92 | + return redirect ($this->redirectPath ()); |
|
93 | 93 | } |
94 | 94 | } |
@@ -14,25 +14,25 @@ |
||
14 | 14 | */ |
15 | 15 | protected function auth_routes() |
16 | 16 | { |
17 | - if (WhichPortal::isManagerPortal()) { |
|
17 | + if (WhichPortal::isManagerPortal ()) { |
|
18 | 18 | $routes = [ |
19 | - 'home' => route('manager.home'), |
|
20 | - 'login' => route('manager.login'), |
|
21 | - 'register' => route('manager.register'), |
|
19 | + 'home' => route ('manager.home'), |
|
20 | + 'login' => route ('manager.login'), |
|
21 | + 'register' => route ('manager.register'), |
|
22 | 22 | 'password' => [ |
23 | - 'email' => route('manager.password.email'), |
|
24 | - 'request' => route('manager.password.request'), |
|
23 | + 'email' => route ('manager.password.email'), |
|
24 | + 'request' => route ('manager.password.request'), |
|
25 | 25 | ], |
26 | 26 | // 'passwords.reset' => route('manager.password.reset'), |
27 | 27 | ]; |
28 | 28 | } else { |
29 | 29 | $routes = [ |
30 | - 'home' => route('home'), |
|
31 | - 'login' => route('login'), |
|
32 | - 'register' => route('register'), |
|
30 | + 'home' => route ('home'), |
|
31 | + 'login' => route ('login'), |
|
32 | + 'register' => route ('register'), |
|
33 | 33 | 'password' => [ |
34 | - 'email' => route('password.email'), |
|
35 | - 'request' => route('password.request'), |
|
34 | + 'email' => route ('password.email'), |
|
35 | + 'request' => route ('password.request'), |
|
36 | 36 | ], |
37 | 37 | // 'passwords.reset' => route('password.reset'), |
38 | 38 | ]; |
@@ -20,15 +20,15 @@ discard block |
||
20 | 20 | public function showFirstVisitManagerForm() |
21 | 21 | { |
22 | 22 | $routes = [ |
23 | - 'return' => route('home'), |
|
24 | - 'continue' => route('manager.finish_registration'), |
|
23 | + 'return' => route ('home'), |
|
24 | + 'continue' => route ('manager.finish_registration'), |
|
25 | 25 | ]; |
26 | 26 | |
27 | - return view('auth.first_visit_manager', [ |
|
27 | + return view ('auth.first_visit_manager', [ |
|
28 | 28 | 'routes' => $routes, |
29 | - 'first_visit' => Lang::get('common/auth/first_manager_visit'), |
|
30 | - 'departments' => Department::all(), |
|
31 | - 'not_in_gov_option' => ['value' => 0, 'name' => Lang::get('common/auth/register.not_in_gov')], |
|
29 | + 'first_visit' => Lang::get ('common/auth/first_manager_visit'), |
|
30 | + 'departments' => Department::all (), |
|
31 | + 'not_in_gov_option' => ['value' => 0, 'name' => Lang::get ('common/auth/register.not_in_gov')], |
|
32 | 32 | ]); |
33 | 33 | } |
34 | 34 | |
@@ -40,34 +40,34 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function finishManagerRegistration(Request $request) |
42 | 42 | { |
43 | - $data = $request->all(); |
|
44 | - $validator = RegistrationValidator::finalizeManagerValidator($data); |
|
45 | - $validator->validate(); |
|
43 | + $data = $request->all (); |
|
44 | + $validator = RegistrationValidator::finalizeManagerValidator ($data); |
|
45 | + $validator->validate (); |
|
46 | 46 | |
47 | - $user = $request->user(); |
|
47 | + $user = $request->user (); |
|
48 | 48 | |
49 | 49 | // Save manager specific fields to user |
50 | - $managerDepartment = Department::find($data['department']); |
|
50 | + $managerDepartment = Department::find ($data['department']); |
|
51 | 51 | $inGovernment = ($managerDepartment !== null); |
52 | 52 | $user->not_in_gov = !$inGovernment; |
53 | 53 | $user->gov_email = $inGovernment ? $data['gov_email'] : null; |
54 | - $user->save(); |
|
55 | - $user->refresh(); |
|
54 | + $user->save (); |
|
55 | + $user->refresh (); |
|
56 | 56 | |
57 | 57 | // Add (or update) manager profile |
58 | 58 | // NOTE: modifying a field in $user, and saving it, appears to create Manager object. I don't know how. -- Tristan |
59 | 59 | // That means that after setting not_in_gov or gov_email, a manager already exists here. Adding a new one will throw an exception. |
60 | 60 | $department_id = $inGovernment ? $managerDepartment->id : null; |
61 | 61 | if ($user->manager === null) { |
62 | - $user->applicant()->save(new Manager()); |
|
63 | - $user->refresh(); |
|
62 | + $user->applicant ()->save (new Manager ()); |
|
63 | + $user->refresh (); |
|
64 | 64 | } |
65 | 65 | $user->manager->department_id = $department_id; |
66 | - $user->manager->save(); |
|
66 | + $user->manager->save (); |
|
67 | 67 | |
68 | - $user->refresh(); |
|
69 | - $expectedUrl = session()->remove('url.expected'); |
|
70 | - session()->remove('url.expected'); |
|
71 | - return redirect($expectedUrl); |
|
68 | + $user->refresh (); |
|
69 | + $expectedUrl = session ()->remove ('url.expected'); |
|
70 | + session ()->remove ('url.expected'); |
|
71 | + return redirect ($expectedUrl); |
|
72 | 72 | } |
73 | 73 | } |