@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | $this->hideSensitiveRequestDetails(); |
22 | 22 | |
23 | - Telescope::filter(function (IncomingEntry $entry) { |
|
23 | + Telescope::filter(function(IncomingEntry $entry) { |
|
24 | 24 | if ($this->app->isLocal()) { |
25 | 25 | return true; |
26 | 26 | } |
@@ -61,6 +61,6 @@ discard block |
||
61 | 61 | */ |
62 | 62 | protected function gate() |
63 | 63 | { |
64 | - Gate::define('viewTelescope', fn ($user = null) => backpack_user() && backpack_user()->email === config('app.admin_email')); |
|
64 | + Gate::define('viewTelescope', fn($user = null) => backpack_user() && backpack_user()->email === config('app.admin_email')); |
|
65 | 65 | } |
66 | 66 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | public function updateCourse(Course $course) : void |
134 | 134 | { |
135 | - if (! $course->lms_id) { |
|
135 | + if (!$course->lms_id) { |
|
136 | 136 | $this->createCourse($course); |
137 | 137 | } |
138 | 138 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | Log::info('found these teachers IDs on LMS:'.implode(', ', $teachers->pluck('id')->toArray())); |
162 | 162 | |
163 | 163 | // if the course has no teacher, stop |
164 | - if (! $course->teacher) { |
|
164 | + if (!$course->teacher) { |
|
165 | 165 | Log::alert('The course has no teacher on local system, removing all teachers from remote'); |
166 | 166 | foreach ($teachers as $teacher) { |
167 | 167 | $this->removeTeacher($course->lms_id, $teacher['id']); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
179 | - if (! $course->teacher->user->lms_id || ! $teachers->contains('id', $course->teacher->user->lms_id)) { |
|
179 | + if (!$course->teacher->user->lms_id || !$teachers->contains('id', $course->teacher->user->lms_id)) { |
|
180 | 180 | Log::info('the course teacher has changed, need to update it'); |
181 | 181 | $this->addTeacher($course); |
182 | 182 | } |
@@ -186,14 +186,14 @@ discard block |
||
186 | 186 | |
187 | 187 | public function enrollStudent(Course $course, Student $student): void |
188 | 188 | { |
189 | - if (! $course->lms_id) { |
|
189 | + if (!$course->lms_id) { |
|
190 | 190 | abort(404, 'This course is not synced with external LMS'); |
191 | 191 | } |
192 | 192 | |
193 | 193 | $courseId = $course->lms_id; |
194 | 194 | |
195 | 195 | // if the student is not synced with the LMS, create them |
196 | - if (! $student->user->lms_id) { |
|
196 | + if (!$student->user->lms_id) { |
|
197 | 197 | $this->createUser($student->user); |
198 | 198 | } |
199 | 199 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | // only process if the course has a teacher |
217 | 217 | if ($course->teacher_id) { |
218 | 218 | // if the teacher doesn't exist on LMS, create them |
219 | - if (! $course->teacher->user->lms_id) { |
|
219 | + if (!$course->teacher->user->lms_id) { |
|
220 | 220 | Log::info('creating user now'); |
221 | 221 | $this->createUser($course->teacher->user); |
222 | 222 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | // get past events for the course |
115 | - $events = $course->events->filter(fn ($value, $key) => Carbon::parse($value->start) < Carbon::now())->sortByDesc('start'); |
|
115 | + $events = $course->events->filter(fn($value, $key) => Carbon::parse($value->start) < Carbon::now())->sortByDesc('start'); |
|
116 | 116 | |
117 | 117 | // if the course has any past events |
118 | 118 | if (($events->count() == 0) || ($course->enrollments()->count() == 0)) { |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | |
197 | 197 | public function toggleEventAttendanceStatus(Event $event, Request $request) |
198 | 198 | { |
199 | - if (! backpack_user()->hasPermissionTo('courses.edit')) { |
|
199 | + if (!backpack_user()->hasPermissionTo('courses.edit')) { |
|
200 | 200 | abort(403); |
201 | 201 | } |
202 | 202 | $event->exempt_attendance = (int) $request->status; |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | |
208 | 208 | public function toggleCourseAttendanceStatus(Course $course, Request $request) |
209 | 209 | { |
210 | - if (! backpack_user()->hasPermissionTo('courses.edit')) { |
|
210 | + if (!backpack_user()->hasPermissionTo('courses.edit')) { |
|
211 | 211 | abort(403); |
212 | 212 | } |
213 | 213 | $course->exempt_attendance = (int) $request->status; |
@@ -72,7 +72,7 @@ |
||
72 | 72 | 'type' => 'relationship', |
73 | 73 | 'name' => 'category', // the method on your model that defines the relationship |
74 | 74 | 'ajax' => true, |
75 | - 'inline_create' => [ // specify the entity in singular |
|
75 | + 'inline_create' => [// specify the entity in singular |
|
76 | 76 | 'entity' => 'gradetypecategory', // the entity in singular |
77 | 77 | // OPTIONALS |
78 | 78 | 'force_select' => true, // should the inline-created entry be immediately selected? |
@@ -28,14 +28,14 @@ |
||
28 | 28 | protected function setupListOperation() |
29 | 29 | { |
30 | 30 | CRUD::addColumn(['name' => 'name', 'label' => 'Name']); |
31 | - CRUD::addColumn(['name' => 'lms_id', 'label' => 'LMS code', 'type' => 'text'], ); |
|
31 | + CRUD::addColumn(['name' => 'lms_id', 'label' => 'LMS code', 'type' => 'text'],); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | protected function setupCreateOperation() |
35 | 35 | { |
36 | 36 | CRUD::setValidation(StoreRequest::class); |
37 | 37 | CRUD::addField(['name' => 'name', 'label' => 'Name', 'type' => 'text']); |
38 | - CRUD::addField(['name' => 'lms_id', 'label' => 'LMS code', 'type' => 'text'], ); |
|
38 | + CRUD::addField(['name' => 'lms_id', 'label' => 'LMS code', 'type' => 'text'],); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | protected function setupUpdateOperation() |
@@ -97,7 +97,7 @@ |
||
97 | 97 | 'type' => 'date', |
98 | 98 | ]); |
99 | 99 | |
100 | - CRUD::addField([ // Checkbox |
|
100 | + CRUD::addField([// Checkbox |
|
101 | 101 | 'name' => 'auto_renewal', |
102 | 102 | 'label' => __('Tacit renewal'), |
103 | 103 | 'type' => 'checkbox', |
@@ -168,58 +168,58 @@ discard block |
||
168 | 168 | ]); |
169 | 169 | |
170 | 170 | CRUD::addFilter( |
171 | - [ // select2 filter |
|
171 | + [// select2 filter |
|
172 | 172 | 'name' => 'rhythm_id', |
173 | 173 | 'type' => 'select2', |
174 | 174 | 'label'=> __('Rhythm'), |
175 | 175 | ], |
176 | - fn () => Rhythm::all()->pluck('name', 'id')->toArray(), |
|
177 | - function ($value) { // if the filter is active |
|
176 | + fn() => Rhythm::all()->pluck('name', 'id')->toArray(), |
|
177 | + function($value) { // if the filter is active |
|
178 | 178 | CRUD::addClause('where', 'rhythm_id', $value); |
179 | 179 | }, |
180 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
180 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
181 | 181 | } |
182 | 182 | ); |
183 | 183 | |
184 | 184 | CRUD::addFilter( |
185 | - [ // select2 filter |
|
185 | + [// select2 filter |
|
186 | 186 | 'name' => 'teacher_id', |
187 | 187 | 'type' => 'select2', |
188 | 188 | 'label'=> __('Teacher'), |
189 | 189 | ], |
190 | - fn () => Teacher::all()->pluck('name', 'id')->toArray(), |
|
191 | - function ($value) { // if the filter is active |
|
190 | + fn() => Teacher::all()->pluck('name', 'id')->toArray(), |
|
191 | + function($value) { // if the filter is active |
|
192 | 192 | CRUD::addClause('where', 'teacher_id', $value); |
193 | 193 | }, |
194 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
194 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
195 | 195 | } |
196 | 196 | ); |
197 | 197 | |
198 | 198 | CRUD::addFilter( |
199 | - [ // select2 filter |
|
199 | + [// select2 filter |
|
200 | 200 | 'name' => 'level_id', |
201 | 201 | 'type' => 'select2', |
202 | 202 | 'label'=> __('Level'), |
203 | 203 | ], |
204 | - fn () => Level::all()->pluck('name', 'id')->toArray(), |
|
205 | - function ($value) { // if the filter is active |
|
204 | + fn() => Level::all()->pluck('name', 'id')->toArray(), |
|
205 | + function($value) { // if the filter is active |
|
206 | 206 | CRUD::addClause('where', 'level_id', $value); |
207 | 207 | }, |
208 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
208 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
209 | 209 | } |
210 | 210 | ); |
211 | 211 | |
212 | 212 | CRUD::addFilter( |
213 | - [ // select2 filter |
|
213 | + [// select2 filter |
|
214 | 214 | 'name' => 'period_id', |
215 | 215 | 'type' => 'select2', |
216 | 216 | 'label'=> __('Period'), |
217 | 217 | ], |
218 | - fn () => Period::all()->pluck('name', 'id')->toArray(), |
|
219 | - function ($value) { // if the filter is active |
|
218 | + fn() => Period::all()->pluck('name', 'id')->toArray(), |
|
219 | + function($value) { // if the filter is active |
|
220 | 220 | CRUD::addClause('where', 'period_id', $value); |
221 | 221 | }, |
222 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
222 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
223 | 223 | $period = Period::get_default_period()->id; |
224 | 224 | CRUD::addClause('where', 'period_id', $period); |
225 | 225 | $this->crud->getRequest()->request->add(['period_id' => $period]); // to make the filter look active |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | 'tab' => __('Course info'), |
366 | 366 | ], |
367 | 367 | |
368 | - [ // repeatable |
|
368 | + [// repeatable |
|
369 | 369 | 'name' => 'times', |
370 | 370 | 'label' => __('Course Schedule'), |
371 | 371 | 'type' => 'repeatable', |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | 'tab' => __('Schedule'), |
405 | 405 | ], |
406 | 406 | |
407 | - [ // view |
|
407 | + [// view |
|
408 | 408 | 'name' => 'custom-ajax-button', |
409 | 409 | 'type' => 'view', |
410 | 410 | 'view' => 'courses/schedule-preset-alert', |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | 'tab' => __('Course info'), |
559 | 559 | ], |
560 | 560 | |
561 | - [ // repeatable |
|
561 | + [// repeatable |
|
562 | 562 | 'name' => 'times', |
563 | 563 | 'label' => __('Course Schedule'), |
564 | 564 | 'type' => 'repeatable', |
@@ -166,9 +166,9 @@ |
||
166 | 166 | // add photo |
167 | 167 | if ($request->data['userPicture']) { |
168 | 168 | $student |
169 | - ->addMediaFromBase64($request->data['userPicture']) |
|
170 | - ->usingFileName('profilePicture.jpg') |
|
171 | - ->toMediaCollection('profile-picture'); |
|
169 | + ->addMediaFromBase64($request->data['userPicture']) |
|
170 | + ->usingFileName('profilePicture.jpg') |
|
171 | + ->toMediaCollection('profile-picture'); |
|
172 | 172 | |
173 | 173 | Log::info('Profile picture added to the student profile'); |
174 | 174 | } |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | $username_parts = array_filter(explode(' ', strtolower($fullName))); |
31 | 31 | $username_parts = array_slice($username_parts, -2); |
32 | 32 | |
33 | - $part1 = (! empty($username_parts[0])) ? substr($username_parts[0], 0, 3) : ''; |
|
34 | - $part2 = (! empty($username_parts[1])) ? substr($username_parts[1], 0, 8) : ''; |
|
33 | + $part1 = (!empty($username_parts[0])) ? substr($username_parts[0], 0, 3) : ''; |
|
34 | + $part2 = (!empty($username_parts[1])) ? substr($username_parts[1], 0, 8) : ''; |
|
35 | 35 | $part3 = random_int(999, 9999); |
36 | 36 | |
37 | 37 | $username = $part1.$part2.$part3; //str_shuffle to randomly shuffle all characters |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | { |
122 | 122 | |
123 | 123 | // if registration is closed, deny access |
124 | - if (! config('backpack.base.registration_open')) { |
|
124 | + if (!config('backpack.base.registration_open')) { |
|
125 | 125 | abort(403, trans('backpack::base.registration_closed')); |
126 | 126 | } |
127 | 127 |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $angle = 0; |
72 | 72 | $width = imagesx($image); |
73 | 73 | $centerX = $width / 2; |
74 | - [$left, , $right] = imageftbbox($font_size, $angle, $font, $text); |
|
74 | + [$left,, $right] = imageftbbox($font_size, $angle, $font, $text); |
|
75 | 75 | $left_offset = ($right - $left) / 2; |
76 | 76 | $x = $centerX - $left_offset; |
77 | 77 | imagettftext($image, $font_size, $angle, $x, 450, $black, $font, $text); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $angle = 0; |
82 | 82 | $width = imagesx($image); |
83 | 83 | $centerX = $width / 2; |
84 | - [$left, , $right] = imageftbbox($font_size, $angle, $font, $text); |
|
84 | + [$left,, $right] = imageftbbox($font_size, $angle, $font, $text); |
|
85 | 85 | $left_offset = ($right - $left) / 2; |
86 | 86 | $x = $centerX - $left_offset; |
87 | 87 | imagettftext($image, $font_size, $angle, $x, 525, $black, $font, $text); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $angle = 0; |
92 | 92 | $width = imagesx($image); |
93 | 93 | $centerX = $width / 2; |
94 | - [$left, , $right] = imageftbbox($font_size, $angle, $font, $text); |
|
94 | + [$left,, $right] = imageftbbox($font_size, $angle, $font, $text); |
|
95 | 95 | $left_offset = ($right - $left) / 2; |
96 | 96 | $x = $centerX - $left_offset; |
97 | 97 | imagettftext($image, $font_size, $angle, $x, 620, $black, $font, $text); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $angle = 0; |
102 | 102 | $width = imagesx($image); |
103 | 103 | $centerX = $width / 2; |
104 | - [$left, , $right] = imageftbbox($font_size, $angle, $font, $text); |
|
104 | + [$left,, $right] = imageftbbox($font_size, $angle, $font, $text); |
|
105 | 105 | $left_offset = ($right - $left) / 2; |
106 | 106 | $x = $centerX - $left_offset; |
107 | 107 | imagettftext($image, $font_size, $angle, $x, 690, $black, $font, $text); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $angle = 0; |
115 | 115 | $width = imagesx($image); |
116 | 116 | $centerX = $width / 2; |
117 | - [$left, , $right] = imageftbbox($font_size, $angle, $font, $text); |
|
117 | + [$left,, $right] = imageftbbox($font_size, $angle, $font, $text); |
|
118 | 118 | $left_offset = ($right - $left) / 2; |
119 | 119 | $x = $centerX - $left_offset; |
120 | 120 | imagettftext($image, $font_size, $angle, $x, 755, $black, $font, $text); |