@@ -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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -11,10 +11,10 @@ discard block |
||
11 | 11 | * |
12 | 12 | * @return boolean |
13 | 13 | */ |
14 | - public function authorize() : bool |
|
14 | + public function authorize () : bool |
|
15 | 15 | { |
16 | 16 | // Only allow updates if the user is a logged in Admin. |
17 | - return backpack_auth()->check(); |
|
17 | + return backpack_auth ()->check (); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | /** |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @return string[] |
24 | 24 | */ |
25 | - public function rules() : array |
|
25 | + public function rules () : array |
|
26 | 26 | { |
27 | 27 | return [ |
28 | 28 | 'name' => 'required', |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return string[] |
37 | 37 | */ |
38 | - public function messages() : array |
|
38 | + public function messages () : array |
|
39 | 39 | { |
40 | 40 | return [ |
41 | 41 | 'name.required' => 'Please enter a department name.', |
@@ -11,9 +11,9 @@ |
||
11 | 11 | * |
12 | 12 | * @return boolean |
13 | 13 | */ |
14 | - public function authorize(): bool |
|
14 | + public function authorize (): bool |
|
15 | 15 | { |
16 | 16 | // The STORE job poster method requires the user's manager id. |
17 | - return $this->user()->manager !== null; |
|
17 | + return $this->user ()->manager !== null; |
|
18 | 18 | } |
19 | 19 | } |