@@ -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 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * |
16 | 16 | * @return boolean |
17 | 17 | */ |
18 | - public function authorize(): bool |
|
18 | + public function authorize (): bool |
|
19 | 19 | { |
20 | 20 | return true; |
21 | 21 | } |
@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @return string[] |
27 | 27 | */ |
28 | - public function rules(): array |
|
28 | + public function rules (): array |
|
29 | 29 | { |
30 | 30 | return [ |
31 | 31 | '*.id' => 'present', |
32 | - '*.criteria_type_id' => ['required', new ValidIdRule(CriteriaType::class)], |
|
33 | - '*.skill_id' => ['required', new ValidIdRule(Skill::class)], |
|
34 | - '*.skill_level_id' => ['required', new ValidIdRule(SkillLevel::class)], |
|
32 | + '*.criteria_type_id' => ['required', new ValidIdRule (CriteriaType::class)], |
|
33 | + '*.skill_id' => ['required', new ValidIdRule (Skill::class)], |
|
34 | + '*.skill_level_id' => ['required', new ValidIdRule (SkillLevel::class)], |
|
35 | 35 | '*.en.description' => 'nullable|string', |
36 | 36 | '*.en.specificity' => 'nullable|string', |
37 | 37 | '*.fr.description' => 'nullable|string', |
@@ -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 | 'key' => 'required|size:2|alpha|unique:classifications,key' |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @return string[] |
36 | 36 | */ |
37 | - public function messages() : array |
|
37 | + public function messages () : array |
|
38 | 38 | { |
39 | 39 | return [ |
40 | 40 | 'key.required' => 'Please enter a classification key.', |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * |
12 | 12 | * @return boolean |
13 | 13 | */ |
14 | - public function authorize(): bool |
|
14 | + public function authorize (): bool |
|
15 | 15 | { |
16 | 16 | return true; |
17 | 17 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @return string[] |
23 | 23 | */ |
24 | - public function rules(): array |
|
24 | + public function rules (): array |
|
25 | 25 | { |
26 | 26 | return [ |
27 | 27 | '*.id' => 'present', |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @return bool |
18 | 18 | */ |
19 | - public function authorize() |
|
19 | + public function authorize () |
|
20 | 20 | { |
21 | 21 | return true; |
22 | 22 | } |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return array |
28 | 28 | */ |
29 | - public function rules() |
|
29 | + public function rules () |
|
30 | 30 | { |
31 | - $frequencyRule = new ValidIdRule(Frequency::class); |
|
31 | + $frequencyRule = new ValidIdRule (Frequency::class); |
|
32 | 32 | return [ |
33 | - 'department_id' => ['nullable', new ValidIdRule(Department::class)], |
|
33 | + 'department_id' => ['nullable', new ValidIdRule (Department::class)], |
|
34 | 34 | 'gov_email' => [ |
35 | 35 | 'nullable', |
36 | 36 | 'string', |