@@ -14,17 +14,17 @@ |
||
14 | 14 | * @param \App\Models\Degree $degree Incoming Degree. |
15 | 15 | * @return \Illuminate\Http\Response |
16 | 16 | */ |
17 | - public function destroy(Request $request, Degree $degree) |
|
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 | } |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | * @param \App\Models\Manager $manager Incoming Manager. |
25 | 25 | * @return \Illuminate\Http\Response |
26 | 26 | */ |
27 | - public function show(Request $request, Manager $manager) |
|
27 | + public function show (Request $request, Manager $manager) |
|
28 | 28 | { |
29 | - $manager_profile = Lang::get('applicant/manager_profile'); |
|
29 | + $manager_profile = Lang::get ('applicant/manager_profile'); |
|
30 | 30 | |
31 | 31 | $manager_profile_sections = [ |
32 | 32 | [ |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | ] |
66 | 66 | ]; |
67 | 67 | |
68 | - return view('applicant/manager', [ |
|
68 | + return view ('applicant/manager', [ |
|
69 | 69 | 'manager_profile' => $manager_profile, |
70 | - 'urls' => Lang::get('common/urls'), |
|
70 | + 'urls' => Lang::get ('common/urls'), |
|
71 | 71 | 'manager' => $manager, |
72 | 72 | 'manager_profile_photo_url' => '/images/user.png', // TODO get real photo. |
73 | 73 | 'manager_profile_sections' => $manager_profile_sections, |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | * @param \Illuminate\Http\Request $request Incoming Request. |
82 | 82 | * @return \Illuminate\Http\Response |
83 | 83 | */ |
84 | - public function editAuthenticated(Request $request) |
|
84 | + public function editAuthenticated (Request $request) |
|
85 | 85 | { |
86 | - $manager = $request->user()->manager; |
|
87 | - return redirect(route('manager.profile.edit', $manager)); |
|
86 | + $manager = $request->user ()->manager; |
|
87 | + return redirect (route ('manager.profile.edit', $manager)); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -94,30 +94,30 @@ discard block |
||
94 | 94 | * @param \App\Models\Manager $manager Incoming Manager. |
95 | 95 | * @return \Illuminate\Http\Response |
96 | 96 | */ |
97 | - public function edit(Request $request, Manager $manager) |
|
97 | + public function edit (Request $request, Manager $manager) |
|
98 | 98 | { |
99 | 99 | // TODO: Improve workplace photos, and reference them in template direction from WorkEnvironment model. |
100 | 100 | $workplacePhotos = []; |
101 | 101 | |
102 | - $frequencies = Frequency::all(); |
|
102 | + $frequencies = Frequency::all (); |
|
103 | 103 | $linkedInUrlPattern = LinkedInUrlRule::PATTERN; |
104 | 104 | $twitterHandlePattern = TwitterHandleRule::PATTERN; |
105 | 105 | |
106 | - return view('manager/profile', [ |
|
106 | + return view ('manager/profile', [ |
|
107 | 107 | // Localization. |
108 | - 'profile_l10n' => Lang::get('manager/profile'), |
|
108 | + 'profile_l10n' => Lang::get ('manager/profile'), |
|
109 | 109 | // Data. |
110 | - 'urls' => Lang::get('common/urls'), |
|
110 | + 'urls' => Lang::get ('common/urls'), |
|
111 | 111 | 'user' => $manager->user, |
112 | 112 | 'manager' => $manager, |
113 | 113 | 'manager_profile_photo_url' => '/images/user.png', // TODO get real photo. |
114 | 114 | 'workplace_photos' => $workplacePhotos, |
115 | - 'departments' => Department::all(), |
|
115 | + 'departments' => Department::all (), |
|
116 | 116 | 'telework_options' => $frequencies, |
117 | 117 | 'flex_hour_options' => $frequencies, |
118 | 118 | 'radio_options' => $frequencies, |
119 | - 'managerEN' => $manager->translate('en'), |
|
120 | - 'managerFR' => $manager->translate('fr'), |
|
119 | + 'managerEN' => $manager->translate ('en'), |
|
120 | + 'managerFR' => $manager->translate ('fr'), |
|
121 | 121 | 'linkedInUrlPattern' => $linkedInUrlPattern, |
122 | 122 | 'twitterHandlePattern' => $twitterHandlePattern, |
123 | 123 | ]); |
@@ -130,31 +130,31 @@ discard block |
||
130 | 130 | * @param \App\Models\Manager $manager Incoming Manager. |
131 | 131 | * @return \Illuminate\Http\Response |
132 | 132 | */ |
133 | - public function update(UpdateManagerProfileRequest $request, Manager $manager) |
|
133 | + public function update (UpdateManagerProfileRequest $request, Manager $manager) |
|
134 | 134 | { |
135 | 135 | // TODO: save workplace Photos. |
136 | 136 | // TODO: remove control of name in production. |
137 | - $input = $request->input(); |
|
137 | + $input = $request->input (); |
|
138 | 138 | |
139 | 139 | // redirect to error messages element if validation fails |
140 | - if (isset($request->validator) && $request->validator->fails()) { |
|
140 | + if (isset($request->validator) && $request->validator->fails ()) { |
|
141 | 141 | $hash = '#managerProfileFormErrors'; |
142 | - return redirect(route('manager.profile.edit', $manager).$hash) |
|
143 | - ->withErrors($request->validator) |
|
144 | - ->withInput(); |
|
142 | + return redirect (route ('manager.profile.edit', $manager).$hash) |
|
143 | + ->withErrors ($request->validator) |
|
144 | + ->withInput (); |
|
145 | 145 | } |
146 | 146 | |
147 | - $validated = $request->validated(); |
|
147 | + $validated = $request->validated (); |
|
148 | 148 | |
149 | 149 | $user = $manager->user; |
150 | - $user->fill($validated); |
|
150 | + $user->fill ($validated); |
|
151 | 151 | if (!empty($input['new_password'])) { |
152 | - $user->password = Hash::make($input['new_password']); |
|
152 | + $user->password = Hash::make ($input['new_password']); |
|
153 | 153 | } |
154 | - $user->save(); |
|
154 | + $user->save (); |
|
155 | 155 | |
156 | - $manager->fill($validated); |
|
157 | - $manager->save(); |
|
156 | + $manager->fill ($validated); |
|
157 | + $manager->save (); |
|
158 | 158 | |
159 | 159 | // Use the button that was clicked to decide which element to redirect to. |
160 | 160 | switch ($input['submit']) { |
@@ -172,18 +172,18 @@ discard block |
||
172 | 172 | break; |
173 | 173 | } |
174 | 174 | |
175 | - return redirect(route('manager.profile.edit', $manager).$hash); |
|
175 | + return redirect (route ('manager.profile.edit', $manager).$hash); |
|
176 | 176 | } |
177 | 177 | |
178 | - public function faq(Request $request) |
|
178 | + public function faq (Request $request) |
|
179 | 179 | { |
180 | - $show_demo_notification = $request->user() && $request->user()->isDemoManager(); |
|
180 | + $show_demo_notification = $request->user () && $request->user ()->isDemoManager (); |
|
181 | 181 | |
182 | - return view( |
|
182 | + return view ( |
|
183 | 183 | 'applicant/static_faq', |
184 | 184 | [ |
185 | - 'breadcrumb_home' => route('manager.home'), |
|
186 | - 'faq' => Lang::get('applicant/faq'), |
|
185 | + 'breadcrumb_home' => route ('manager.home'), |
|
186 | + 'faq' => Lang::get ('applicant/faq'), |
|
187 | 187 | 'manager_sidebar_active' => 'active', |
188 | 188 | 'show_demo_notification' => $show_demo_notification, |
189 | 189 | ] |
@@ -13,10 +13,10 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * Class constructor. |
15 | 15 | */ |
16 | - public function __construct() |
|
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 | /** |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @return \Illuminate\Http\Response |
26 | 26 | */ |
27 | - public function index() |
|
27 | + public function index () |
|
28 | 28 | { |
29 | 29 | // TODO: complete. |
30 | 30 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @param \Illuminate\Http\Request $request Incoming Request. |
36 | 36 | * @return \Illuminate\Http\Response |
37 | 37 | */ |
38 | - public function store(Request $request) |
|
38 | + public function store (Request $request) |
|
39 | 39 | { |
40 | 40 | // TODO: complete. |
41 | 41 | } |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | * @param \App\Models\Manager $manager Incoming Manager. |
47 | 47 | * @return \Illuminate\Http\Response |
48 | 48 | */ |
49 | - public function show(Manager $manager) |
|
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 | /** |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @return \Illuminate\Http\Response |
58 | 58 | */ |
59 | - public function showAuthenticated() |
|
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 | /** |
@@ -72,12 +72,12 @@ discard block |
||
72 | 72 | * @param \App\Models\Manager $manager Incoming Manager. |
73 | 73 | * @return \Illuminate\Http\Response |
74 | 74 | */ |
75 | - public function update(UpdateManagerApi $request, Manager $manager) |
|
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 | /** |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param \App\Models\Manager $manager Incoming Manager. |
87 | 87 | * @return \Illuminate\Http\Response |
88 | 88 | */ |
89 | - public function destroy(Manager $manager) |
|
89 | + public function destroy (Manager $manager) |
|
90 | 90 | { |
91 | 91 | // TODO: complete. |
92 | 92 | } |
@@ -12,8 +12,8 @@ |
||
12 | 12 | * |
13 | 13 | * @return mixed |
14 | 14 | */ |
15 | - public function index() |
|
15 | + public function index () |
|
16 | 16 | { |
17 | - return Department::all()->map->toApiArray(); |
|
17 | + return Department::all ()->map->toApiArray (); |
|
18 | 18 | } |
19 | 19 | } |
@@ -15,16 +15,16 @@ discard block |
||
15 | 15 | * @param JobPosterKeyTask $model Incoming Job Poster Key Task object. |
16 | 16 | * @return array |
17 | 17 | */ |
18 | - public function toApiArray(JobPosterKeyTask $model) |
|
18 | + public function toApiArray (JobPosterKeyTask $model) |
|
19 | 19 | { |
20 | - return array_merge($model->toArray(), $model->getTranslationsArray()); |
|
20 | + return array_merge ($model->toArray (), $model->getTranslationsArray ()); |
|
21 | 21 | } |
22 | 22 | |
23 | - public function indexByJob(JobPoster $jobPoster) |
|
23 | + public function indexByJob (JobPoster $jobPoster) |
|
24 | 24 | { |
25 | 25 | $toApiArray = array($this, 'toApiArray'); |
26 | - $taskArray = JobPosterKeyTask::where('job_poster_id', $jobPoster->id)->get()->map($toApiArray); |
|
27 | - return response()->json($taskArray); |
|
26 | + $taskArray = JobPosterKeyTask::where ('job_poster_id', $jobPoster->id)->get ()->map ($toApiArray); |
|
27 | + return response ()->json ($taskArray); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -34,39 +34,39 @@ discard block |
||
34 | 34 | * @param \App\Models\JobPoster $jobPoster Incoming Job Poster object. |
35 | 35 | * @return \Illuminate\Http\Response |
36 | 36 | */ |
37 | - public function batchUpdate(BatchUpdateJobTask $request, JobPoster $jobPoster) |
|
37 | + public function batchUpdate (BatchUpdateJobTask $request, JobPoster $jobPoster) |
|
38 | 38 | { |
39 | 39 | $toApiArray = array($this, 'toApiArray'); |
40 | 40 | |
41 | - $newTasks = collect($request->validated()); // Collection of JobPosterKeyTasks. |
|
41 | + $newTasks = collect ($request->validated ()); // Collection of JobPosterKeyTasks. |
|
42 | 42 | $oldTasks = $jobPoster->job_poster_key_tasks; |
43 | 43 | |
44 | 44 | $savedNewTaskIds = []; |
45 | 45 | |
46 | 46 | // First, delete old tasks that weren't resubmitted, and update those that were. |
47 | 47 | foreach ($oldTasks as $task) { |
48 | - $newTask = $newTasks->firstWhere('id', $task['id']); |
|
48 | + $newTask = $newTasks->firstWhere ('id', $task['id']); |
|
49 | 49 | if ($newTask) { |
50 | 50 | $savedNewTaskIds[] = $newTask['id']; |
51 | - $task->fill(collect($newTask)->only(['en', 'fr'])->toArray()); |
|
52 | - $task->save(); |
|
51 | + $task->fill (collect ($newTask)->only (['en', 'fr'])->toArray ()); |
|
52 | + $task->save (); |
|
53 | 53 | } else { |
54 | - $task->delete(); |
|
54 | + $task->delete (); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | 58 | // Now, save any new tasks that remain. |
59 | 59 | foreach ($newTasks as $task) { |
60 | - if ($this->isUnsaved($task, $savedNewTaskIds)) { |
|
61 | - $jobPosterTask = new JobPosterKeyTask(); |
|
60 | + if ($this->isUnsaved ($task, $savedNewTaskIds)) { |
|
61 | + $jobPosterTask = new JobPosterKeyTask (); |
|
62 | 62 | $jobPosterTask->job_poster_id = $jobPoster->id; |
63 | - $jobPosterTask->fill(collect($task)->only(['en', 'fr'])->toArray()); |
|
64 | - $jobPosterTask->save(); |
|
63 | + $jobPosterTask->fill (collect ($task)->only (['en', 'fr'])->toArray ()); |
|
64 | + $jobPosterTask->save (); |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
68 | - $taskArray = $jobPoster->fresh()->job_poster_key_tasks->map($toApiArray); |
|
69 | - return response()->json($taskArray); |
|
68 | + $taskArray = $jobPoster->fresh ()->job_poster_key_tasks->map ($toApiArray); |
|
69 | + return response ()->json ($taskArray); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | * @param number[] $savedTaskIds Array of saved task IDs. |
77 | 77 | * @return boolean |
78 | 78 | */ |
79 | - private function isUnsaved($task, array $savedTaskIds): bool |
|
79 | + private function isUnsaved ($task, array $savedTaskIds): bool |
|
80 | 80 | { |
81 | - return !array_key_exists('id', $task) || !in_array($task['id'], $savedTaskIds); |
|
81 | + return !array_key_exists ('id', $task) || !in_array ($task['id'], $savedTaskIds); |
|
82 | 82 | } |
83 | 83 | } |
@@ -12,23 +12,23 @@ |
||
12 | 12 | * |
13 | 13 | * @return mixed |
14 | 14 | */ |
15 | - public function index() |
|
15 | + public function index () |
|
16 | 16 | { |
17 | - $skills = Skill::with('classifications')->get(); |
|
17 | + $skills = Skill::with ('classifications')->get (); |
|
18 | 18 | $skillsArray = []; |
19 | 19 | // TODO: improve effiency of getting translations. |
20 | 20 | foreach ($skills as $skill) { |
21 | 21 | $translations = [ |
22 | 22 | 'en' => [ |
23 | - 'name' => $skill->getTranslation('name', 'en'), |
|
24 | - 'description' => $skill->getTranslation('description', 'en'), |
|
23 | + 'name' => $skill->getTranslation ('name', 'en'), |
|
24 | + 'description' => $skill->getTranslation ('description', 'en'), |
|
25 | 25 | ], |
26 | 26 | 'fr' => [ |
27 | - 'name' => $skill->getTranslation('name', 'fr'), |
|
28 | - 'description' => $skill->getTranslation('description', 'fr'), |
|
27 | + 'name' => $skill->getTranslation ('name', 'fr'), |
|
28 | + 'description' => $skill->getTranslation ('description', 'fr'), |
|
29 | 29 | ] |
30 | 30 | ]; |
31 | - $skillsArray[] = array_merge($skill->toArray(), $translations); |
|
31 | + $skillsArray[] = array_merge ($skill->toArray (), $translations); |
|
32 | 32 | } |
33 | 33 | return ['skills' => $skillsArray]; |
34 | 34 | } |
@@ -14,17 +14,17 @@ |
||
14 | 14 | * @param \App\Models\WorkExperience $workExperience Incoming Work Experience. |
15 | 15 | * @return \Illuminate\Http\Response |
16 | 16 | */ |
17 | - public function destroy(Request $request, WorkExperience $workExperience) |
|
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 | } |
@@ -17,31 +17,31 @@ discard block |
||
17 | 17 | * @throws \InvalidArgumentException For missing $question. |
18 | 18 | * @return mixed |
19 | 19 | */ |
20 | - public function store(Request $request) |
|
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 | |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | * @param \App\Models\RatingGuideQuestion $ratingGuideQuestion Incoming object. |
52 | 52 | * @return mixed |
53 | 53 | */ |
54 | - public function show(RatingGuideQuestion $ratingGuideQuestion) |
|
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 | /** |
@@ -69,25 +69,25 @@ discard block |
||
69 | 69 | * @throws \InvalidArgumentException For missing $question. |
70 | 70 | * @return mixed |
71 | 71 | */ |
72 | - public function update(Request $request, RatingGuideQuestion $ratingGuideQuestion) |
|
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 | |
@@ -97,10 +97,10 @@ discard block |
||
97 | 97 | * @param \App\Models\RatingGuideQuestion $ratingGuideQuestion Incoming object. |
98 | 98 | * @return mixed |
99 | 99 | */ |
100 | - public function destroy(RatingGuideQuestion $ratingGuideQuestion) |
|
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" |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | { |
12 | 12 | use AuthorizesRequests, DispatchesJobs, ValidatesRequests; |
13 | 13 | |
14 | - public function getRelativeIds($input, $relativeType) |
|
14 | + public function getRelativeIds ($input, $relativeType) |
|
15 | 15 | { |
16 | 16 | $relativeIds = []; |
17 | 17 | if (isset($input['relatives'])) { |
@@ -25,30 +25,30 @@ discard block |
||
25 | 25 | return $relativeIds; |
26 | 26 | } |
27 | 27 | |
28 | - public function shiftFirstLevelArrayKeysToBottom(array $nestedArray) |
|
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 | - protected function addKeyAsFinalIndex($finalKey, $array) |
|
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 | } |
47 | 47 | } |
48 | 48 | |
49 | - protected function expandNestedArraysIntoKeyListAndValue($nestedArray) |
|
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 | } |
@@ -69,12 +69,12 @@ discard block |
||
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
72 | - protected function mergeExpandedTrees($expandedArray) |
|
72 | + protected function mergeExpandedTrees ($expandedArray) |
|
73 | 73 | { |
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 | } |
@@ -103,12 +103,12 @@ discard block |
||
103 | 103 | return $mergedArray; |
104 | 104 | } |
105 | 105 | |
106 | - protected function rotateKeys($expandedArray, $steps) |
|
106 | + protected function rotateKeys ($expandedArray, $steps) |
|
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 | } |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | * @param string[] $content The array being returned in response. |
122 | 122 | * @return \Illuminate\Http\Response |
123 | 123 | */ |
124 | - protected function formatAjaxResponse(array $content) |
|
124 | + protected function formatAjaxResponse (array $content) |
|
125 | 125 | { |
126 | - return response()->json($content); |
|
126 | + return response ()->json ($content); |
|
127 | 127 | } |
128 | 128 | } |