@@ -175,58 +175,58 @@ discard block |
||
| 175 | 175 | ]); |
| 176 | 176 | |
| 177 | 177 | CRUD::addFilter( |
| 178 | - [ // select2 filter |
|
| 178 | + [// select2 filter |
|
| 179 | 179 | 'name' => 'rhythm_id', |
| 180 | 180 | 'type' => 'select2', |
| 181 | 181 | 'label' => __('Rhythm'), |
| 182 | 182 | ], |
| 183 | - fn () => Rhythm::all()->pluck('name', 'id')->toArray(), |
|
| 184 | - function ($value) { |
|
| 183 | + fn() => Rhythm::all()->pluck('name', 'id')->toArray(), |
|
| 184 | + function($value) { |
|
| 185 | 185 | CRUD::addClause('where', 'rhythm_id', $value); |
| 186 | 186 | }, |
| 187 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 187 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 188 | 188 | } |
| 189 | 189 | ); |
| 190 | 190 | |
| 191 | 191 | CRUD::addFilter( |
| 192 | - [ // select2 filter |
|
| 192 | + [// select2 filter |
|
| 193 | 193 | 'name' => 'teacher_id', |
| 194 | 194 | 'type' => 'select2', |
| 195 | 195 | 'label' => __('Teacher'), |
| 196 | 196 | ], |
| 197 | - fn () => Teacher::all()->pluck('name', 'id')->toArray(), |
|
| 198 | - function ($value) { |
|
| 197 | + fn() => Teacher::all()->pluck('name', 'id')->toArray(), |
|
| 198 | + function($value) { |
|
| 199 | 199 | CRUD::addClause('where', 'teacher_id', $value); |
| 200 | 200 | }, |
| 201 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 201 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 202 | 202 | } |
| 203 | 203 | ); |
| 204 | 204 | |
| 205 | 205 | CRUD::addFilter( |
| 206 | - [ // select2 filter |
|
| 206 | + [// select2 filter |
|
| 207 | 207 | 'name' => 'level_id', |
| 208 | 208 | 'type' => 'select2', |
| 209 | 209 | 'label' => __('Level'), |
| 210 | 210 | ], |
| 211 | - fn () => Level::all()->pluck('name', 'id')->toArray(), |
|
| 212 | - function ($value) { |
|
| 211 | + fn() => Level::all()->pluck('name', 'id')->toArray(), |
|
| 212 | + function($value) { |
|
| 213 | 213 | CRUD::addClause('where', 'level_id', $value); |
| 214 | 214 | }, |
| 215 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 215 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 216 | 216 | } |
| 217 | 217 | ); |
| 218 | 218 | |
| 219 | 219 | CRUD::addFilter( |
| 220 | - [ // select2 filter |
|
| 220 | + [// select2 filter |
|
| 221 | 221 | 'name' => 'period_id', |
| 222 | 222 | 'type' => 'select2', |
| 223 | 223 | 'label' => __('Period'), |
| 224 | 224 | ], |
| 225 | - fn () => Period::all()->pluck('name', 'id')->toArray(), |
|
| 226 | - function ($value) { |
|
| 225 | + fn() => Period::all()->pluck('name', 'id')->toArray(), |
|
| 226 | + function($value) { |
|
| 227 | 227 | CRUD::addClause('where', 'period_id', $value); |
| 228 | 228 | }, |
| 229 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 229 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 230 | 230 | $period = Period::get_default_period()->id; |
| 231 | 231 | CRUD::addClause('where', 'period_id', $period); |
| 232 | 232 | $this->crud->getRequest()->request->add(['period_id' => $period]); // to make the filter look active |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | 'tab' => __('Course info'), |
| 381 | 381 | ], |
| 382 | 382 | |
| 383 | - [ // repeatable |
|
| 383 | + [// repeatable |
|
| 384 | 384 | 'name' => 'times', |
| 385 | 385 | 'label' => __('Course Schedule'), |
| 386 | 386 | 'type' => 'repeatable', |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | 'tab' => __('Schedule'), |
| 420 | 420 | ], |
| 421 | 421 | |
| 422 | - [ // view |
|
| 422 | + [// view |
|
| 423 | 423 | 'name' => 'custom-ajax-button', |
| 424 | 424 | 'type' => 'view', |
| 425 | 425 | 'view' => 'courses/schedule-preset-alert', |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | 'tab' => __('Course info'), |
| 582 | 582 | ], |
| 583 | 583 | |
| 584 | - [ // repeatable |
|
| 584 | + [// repeatable |
|
| 585 | 585 | 'name' => 'times', |
| 586 | 586 | 'label' => __('Course Schedule'), |
| 587 | 587 | 'type' => 'repeatable', |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | CRUD::addClause('internal'); |
| 55 | 55 | $permissions = backpack_user()->getAllPermissions(); |
| 56 | 56 | |
| 57 | - if (! $permissions->contains('name', 'courses.edit')) { |
|
| 57 | + if (!$permissions->contains('name', 'courses.edit')) { |
|
| 58 | 58 | CRUD::denyAccess(['update', 'create']); |
| 59 | 59 | } |
| 60 | 60 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | CRUD::addButtonFromView('line', 'children_badge', 'children_badge', 'beginning'); |
| 66 | 66 | |
| 67 | - if (! $permissions->contains('name', 'courses.delete')) { |
|
| 67 | + if (!$permissions->contains('name', 'courses.delete')) { |
|
| 68 | 68 | CRUD::denyAccess(['delete']); |
| 69 | 69 | } |
| 70 | 70 | |
@@ -196,11 +196,11 @@ discard block |
||
| 196 | 196 | 'type' => 'select2', |
| 197 | 197 | 'label' => __('Rhythm'), |
| 198 | 198 | ], |
| 199 | - fn () => Rhythm::all()->pluck('name', 'id')->toArray(), |
|
| 200 | - function ($value) { |
|
| 199 | + fn() => Rhythm::all()->pluck('name', 'id')->toArray(), |
|
| 200 | + function($value) { |
|
| 201 | 201 | CRUD::addClause('where', 'rhythm_id', $value); |
| 202 | 202 | }, |
| 203 | - function () { |
|
| 203 | + function() { |
|
| 204 | 204 | // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
| 205 | 205 | } |
| 206 | 206 | ); |
@@ -211,11 +211,11 @@ discard block |
||
| 211 | 211 | 'type' => 'select2', |
| 212 | 212 | 'label' => __('Teacher'), |
| 213 | 213 | ], |
| 214 | - fn () => Teacher::all()->pluck('name', 'id')->toArray(), |
|
| 215 | - function ($value) { |
|
| 214 | + fn() => Teacher::all()->pluck('name', 'id')->toArray(), |
|
| 215 | + function($value) { |
|
| 216 | 216 | CRUD::addClause('where', 'teacher_id', $value); |
| 217 | 217 | }, |
| 218 | - function () { |
|
| 218 | + function() { |
|
| 219 | 219 | // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
| 220 | 220 | } |
| 221 | 221 | ); |
@@ -226,11 +226,11 @@ discard block |
||
| 226 | 226 | 'type' => 'select2', |
| 227 | 227 | 'label' => __('Level'), |
| 228 | 228 | ], |
| 229 | - fn () => Level::all()->pluck('name', 'id')->toArray(), |
|
| 230 | - function ($value) { |
|
| 229 | + fn() => Level::all()->pluck('name', 'id')->toArray(), |
|
| 230 | + function($value) { |
|
| 231 | 231 | CRUD::addClause('where', 'level_id', $value); |
| 232 | 232 | }, |
| 233 | - function () { |
|
| 233 | + function() { |
|
| 234 | 234 | // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
| 235 | 235 | } |
| 236 | 236 | ); |
@@ -241,11 +241,11 @@ discard block |
||
| 241 | 241 | 'type' => 'select2', |
| 242 | 242 | 'label' => __('Period'), |
| 243 | 243 | ], |
| 244 | - fn () => \App\Models\Period::all()->sortByDesc('id')->pluck('name', 'id')->toArray(), |
|
| 245 | - function ($value) { |
|
| 244 | + fn() => \App\Models\Period::all()->sortByDesc('id')->pluck('name', 'id')->toArray(), |
|
| 245 | + function($value) { |
|
| 246 | 246 | CRUD::addClause('where', 'period_id', $value); |
| 247 | 247 | }, |
| 248 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 248 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 249 | 249 | $period = \App\Models\Period::get_default_period()->id; |
| 250 | 250 | CRUD::addClause('where', 'period_id', $period); |
| 251 | 251 | $this->crud->getRequest()->request->add(['period_id' => $period]); // to make the filter look active |
@@ -253,13 +253,13 @@ discard block |
||
| 253 | 253 | ); |
| 254 | 254 | |
| 255 | 255 | CRUD::addFilter( |
| 256 | - [ // add a "simple" filter called Draft |
|
| 256 | + [// add a "simple" filter called Draft |
|
| 257 | 257 | 'type' => 'simple', |
| 258 | 258 | 'name' => 'parent', |
| 259 | 259 | 'label' => __('Hide Children Courses'), |
| 260 | 260 | ], |
| 261 | 261 | false, |
| 262 | - function () { |
|
| 262 | + function() { |
|
| 263 | 263 | CRUD::addClause('parent'); |
| 264 | 264 | } |
| 265 | 265 | ); |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | 'label' => __('Start'), |
| 272 | 272 | ], |
| 273 | 273 | false, |
| 274 | - function ($value) { // if the filter is active, apply these constraints |
|
| 274 | + function($value) { // if the filter is active, apply these constraints |
|
| 275 | 275 | $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR); |
| 276 | 276 | $this->crud->addClause('where', 'start_date', '>=', $dates->from); |
| 277 | 277 | $this->crud->addClause('where', 'start_date', '<=', $dates->to.' 23:59:59'); |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | 'label' => __('End'), |
| 286 | 286 | ], |
| 287 | 287 | false, |
| 288 | - function ($value) { // if the filter is active, apply these constraints |
|
| 288 | + function($value) { // if the filter is active, apply these constraints |
|
| 289 | 289 | $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR); |
| 290 | 290 | $this->crud->addClause('where', 'end_date', '>=', $dates->from); |
| 291 | 291 | $this->crud->addClause('where', 'end_date', '<=', $dates->to.' 23:59:59'); |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | 'tab' => __('Course info'), |
| 391 | 391 | ], |
| 392 | 392 | |
| 393 | - [ // repeatable |
|
| 393 | + [// repeatable |
|
| 394 | 394 | 'name' => 'sublevels', |
| 395 | 395 | 'label' => __('Course sublevels'), |
| 396 | 396 | 'type' => 'repeatable', |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | 'default' => Period::get_enrollments_period()->end, |
| 558 | 558 | ], |
| 559 | 559 | |
| 560 | - [ // repeatable |
|
| 560 | + [// repeatable |
|
| 561 | 561 | 'name' => 'times', |
| 562 | 562 | 'label' => __('Course Schedule'), |
| 563 | 563 | 'type' => 'repeatable', |
@@ -621,14 +621,14 @@ discard block |
||
| 621 | 621 | // number of empty rows to be initialized, by default 1 |
| 622 | 622 | ], |
| 623 | 623 | |
| 624 | - [ // view |
|
| 624 | + [// view |
|
| 625 | 625 | 'name' => 'custom-ajax-button', |
| 626 | 626 | 'type' => 'view', |
| 627 | 627 | 'view' => 'courses/schedule-preset-alert', |
| 628 | 628 | 'tab' => __('Schedule'), |
| 629 | 629 | ], |
| 630 | 630 | |
| 631 | - [ // select_from_array |
|
| 631 | + [// select_from_array |
|
| 632 | 632 | 'name' => 'schedulepreset', |
| 633 | 633 | 'label' => __('Schedule Preset'), |
| 634 | 634 | 'type' => 'select_from_array', |
@@ -652,7 +652,7 @@ discard block |
||
| 652 | 652 | } |
| 653 | 653 | |
| 654 | 654 | if ($this->crud->getCurrentEntry()->children->count() > 0) { |
| 655 | - CRUD::addField([ // view |
|
| 655 | + CRUD::addField([// view |
|
| 656 | 656 | 'name' => 'custom-ajax-button', |
| 657 | 657 | 'type' => 'view', |
| 658 | 658 | 'view' => 'courses/parent-course-alert', |
@@ -660,7 +660,7 @@ discard block |
||
| 660 | 660 | } |
| 661 | 661 | |
| 662 | 662 | if ($this->crud->getCurrentEntry()->parent_course_id !== null) { |
| 663 | - CRUD::addField([ // view |
|
| 663 | + CRUD::addField([// view |
|
| 664 | 664 | 'name' => 'custom-ajax-button', |
| 665 | 665 | 'type' => 'view', |
| 666 | 666 | 'view' => 'courses/child-course-alert', |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | 'label' => trans('backpack::permissionmanager.email'), |
| 49 | 49 | 'type' => 'email', |
| 50 | 50 | ], |
| 51 | - [ // n-n relationship (with pivot table) |
|
| 51 | + [// n-n relationship (with pivot table) |
|
| 52 | 52 | 'label' => trans('backpack::permissionmanager.roles'), |
| 53 | 53 | 'type' => 'select_multiple', |
| 54 | 54 | 'name' => 'roles', |
@@ -67,8 +67,8 @@ discard block |
||
| 67 | 67 | 'label' => trans('backpack::permissionmanager.role'), |
| 68 | 68 | ], |
| 69 | 69 | config('permission.models.role')::all()->pluck(['name', 'id'])->toArray(), |
| 70 | - function ($value) { |
|
| 71 | - $this->crud->addClause('whereHas', 'roles', function ($query) use ($value) { |
|
| 70 | + function($value) { |
|
| 71 | + $this->crud->addClause('whereHas', 'roles', function($query) use ($value) { |
|
| 72 | 72 | $query->where('role_id', '=', $value); |
| 73 | 73 | }); |
| 74 | 74 | } |
@@ -119,12 +119,12 @@ discard block |
||
| 119 | 119 | protected function addFields() |
| 120 | 120 | { |
| 121 | 121 | $this->crud->addFields([ |
| 122 | - [ // Select2 |
|
| 122 | + [// Select2 |
|
| 123 | 123 | 'label' => trans('firstname'), |
| 124 | 124 | 'type' => 'text', |
| 125 | 125 | 'name' => 'firstname', |
| 126 | 126 | ], |
| 127 | - [ // Select2 |
|
| 127 | + [// Select2 |
|
| 128 | 128 | 'label' => trans('lastname'), |
| 129 | 129 | 'type' => 'text', |
| 130 | 130 | 'name' => 'lastname', |
@@ -86,19 +86,19 @@ discard block |
||
| 86 | 86 | ]); |
| 87 | 87 | |
| 88 | 88 | CRUD::addFilter( |
| 89 | - [ // simple filter |
|
| 89 | + [// simple filter |
|
| 90 | 90 | 'type' => 'simple', |
| 91 | 91 | 'name' => 'action', |
| 92 | 92 | 'label' => 'Action', |
| 93 | 93 | ], |
| 94 | 94 | false, |
| 95 | - function () { |
|
| 95 | + function() { |
|
| 96 | 96 | CRUD::addClause('where', 'action', true); |
| 97 | 97 | } |
| 98 | 98 | ); |
| 99 | 99 | |
| 100 | 100 | CRUD::addFilter( |
| 101 | - [ // dropdown filter |
|
| 101 | + [// dropdown filter |
|
| 102 | 102 | 'name' => 'type', |
| 103 | 103 | 'type' => 'dropdown', |
| 104 | 104 | 'label' => 'Type', |
@@ -110,10 +110,10 @@ discard block |
||
| 110 | 110 | Result::class => 'Result', |
| 111 | 111 | |
| 112 | 112 | ], |
| 113 | - function ($value) { |
|
| 113 | + function($value) { |
|
| 114 | 114 | CRUD::addClause('where', 'commentable_type', '=', $value); |
| 115 | 115 | }, |
| 116 | - function () { // if the filter is not active |
|
| 116 | + function() { // if the filter is not active |
|
| 117 | 117 | CRUD::addClause('where', 'commentable_type', '=', Student::class); |
| 118 | 118 | $this->crud->getRequest()->request->add(['commentable_type' => Student::class]); // to make the filter look active |
| 119 | 119 | } |
@@ -116,13 +116,13 @@ discard block |
||
| 116 | 116 | ]); |
| 117 | 117 | |
| 118 | 118 | CRUD::addFilter( |
| 119 | - [ // daterange filter |
|
| 119 | + [// daterange filter |
|
| 120 | 120 | 'type' => 'date_range', |
| 121 | 121 | 'name' => 'from_to', |
| 122 | 122 | 'label' => __('Date range'), |
| 123 | 123 | ], |
| 124 | 124 | false, |
| 125 | - function ($value) { // if the filter is active, apply these constraints |
|
| 125 | + function($value) { // if the filter is active, apply these constraints |
|
| 126 | 126 | $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR); |
| 127 | 127 | |
| 128 | 128 | if ($dates->from) { |
@@ -141,10 +141,10 @@ discard block |
||
| 141 | 141 | 'label' => __('Events with no course'), |
| 142 | 142 | ], |
| 143 | 143 | false, |
| 144 | - function ($value) { // if the filter is active, apply these constraints |
|
| 144 | + function($value) { // if the filter is active, apply these constraints |
|
| 145 | 145 | $this->crud->query->where('course_id', null); |
| 146 | 146 | }, |
| 147 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 147 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 148 | 148 | } |
| 149 | 149 | ); |
| 150 | 150 | |
@@ -155,22 +155,22 @@ discard block |
||
| 155 | 155 | 'label' => __('Events with no teacher'), |
| 156 | 156 | ], |
| 157 | 157 | false, |
| 158 | - function ($value) { // if the filter is active, apply these constraints |
|
| 158 | + function($value) { // if the filter is active, apply these constraints |
|
| 159 | 159 | CRUD::addClause('unassigned'); |
| 160 | 160 | } |
| 161 | 161 | ); |
| 162 | 162 | |
| 163 | 163 | CRUD::addFilter( |
| 164 | - [ // select2 filter |
|
| 164 | + [// select2 filter |
|
| 165 | 165 | 'name' => 'teacher_id', |
| 166 | 166 | 'type' => 'select2', |
| 167 | 167 | 'label' => __('Teacher'), |
| 168 | 168 | ], |
| 169 | - fn () => Teacher::all()->pluck('name', 'id')->toArray(), |
|
| 170 | - function ($value) { |
|
| 169 | + fn() => Teacher::all()->pluck('name', 'id')->toArray(), |
|
| 170 | + function($value) { |
|
| 171 | 171 | CRUD::addClause('where', 'teacher_id', $value); |
| 172 | 172 | }, |
| 173 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 173 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 174 | 174 | } |
| 175 | 175 | ); |
| 176 | 176 | } |
@@ -92,10 +92,10 @@ discard block |
||
| 92 | 92 | 'attribute' => 'lastname', |
| 93 | 93 | 'model' => User::class, |
| 94 | 94 | 'orderable' => true, |
| 95 | - 'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
| 95 | + 'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
| 96 | 96 | ->orderBy('users.lastname', $columnDirection)->select('students.*'), |
| 97 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 98 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 97 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 98 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 99 | 99 | $q->where('lastname', 'like', '%'.$searchTerm.'%'); |
| 100 | 100 | }); |
| 101 | 101 | }, |
@@ -110,10 +110,10 @@ discard block |
||
| 110 | 110 | 'attribute' => 'firstname', |
| 111 | 111 | 'model' => User::class, |
| 112 | 112 | 'orderable' => true, |
| 113 | - 'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
| 113 | + 'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
| 114 | 114 | ->orderBy('users.firstname', $columnDirection)->select('students.*'), |
| 115 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 116 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 115 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 116 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 117 | 117 | $q->where('firstname', 'like', '%'.$searchTerm.'%'); |
| 118 | 118 | }); |
| 119 | 119 | }, |
@@ -127,10 +127,10 @@ discard block |
||
| 127 | 127 | 'attribute' => 'email', |
| 128 | 128 | 'model' => User::class, |
| 129 | 129 | 'orderable' => true, |
| 130 | - 'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
| 130 | + 'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
| 131 | 131 | ->orderBy('users.email', $columnDirection)->select('students.*'), |
| 132 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 133 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 132 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 133 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 134 | 134 | $q->where('email', 'like', '%'.$searchTerm.'%'); |
| 135 | 135 | }); |
| 136 | 136 | }, |
@@ -177,28 +177,28 @@ discard block |
||
| 177 | 177 | ]); |
| 178 | 178 | |
| 179 | 179 | CRUD::addFilter( |
| 180 | - [ // select2 filter |
|
| 180 | + [// select2 filter |
|
| 181 | 181 | 'name' => 'enrolled', |
| 182 | 182 | 'type' => 'select2', |
| 183 | 183 | 'label' => __('Is Enrolled in'), |
| 184 | 184 | ], |
| 185 | - fn () => Period::all()->pluck('name', 'id')->toArray(), |
|
| 186 | - function ($value) { |
|
| 187 | - $this->crud->query = $this->crud->query->whereHas('enrollments', fn ($query) => $query->whereHas('course', function ($q) use ($value) { |
|
| 185 | + fn() => Period::all()->pluck('name', 'id')->toArray(), |
|
| 186 | + function($value) { |
|
| 187 | + $this->crud->query = $this->crud->query->whereHas('enrollments', fn($query) => $query->whereHas('course', function($q) use ($value) { |
|
| 188 | 188 | $q->where('period_id', $value); |
| 189 | 189 | })); |
| 190 | 190 | }, |
| 191 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 191 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 192 | 192 | } |
| 193 | 193 | ); |
| 194 | 194 | |
| 195 | - CRUD::addFilter([ // select2_multiple filter |
|
| 195 | + CRUD::addFilter([// select2_multiple filter |
|
| 196 | 196 | 'name' => 'notenrolled', |
| 197 | 197 | 'type' => 'select2_multiple', |
| 198 | 198 | 'label' => __('Is Not Enrolled in'), |
| 199 | - ], fn () => Period::all()->pluck('name', 'id')->toArray(), function ($values) { |
|
| 199 | + ], fn() => Period::all()->pluck('name', 'id')->toArray(), function($values) { |
|
| 200 | 200 | foreach (json_decode($values, null, 512, JSON_THROW_ON_ERROR) as $value) { |
| 201 | - $this->crud->query = $this->crud->query->whereDoesntHave('enrollments', fn ($query) => $query->whereHas('course', function ($q) use ($value) { |
|
| 201 | + $this->crud->query = $this->crud->query->whereDoesntHave('enrollments', fn($query) => $query->whereHas('course', function($q) use ($value) { |
|
| 202 | 202 | $q->where('period_id', $value); |
| 203 | 203 | })); |
| 204 | 204 | } |
@@ -210,8 +210,8 @@ discard block |
||
| 210 | 210 | 'type' => 'select2', |
| 211 | 211 | 'label' => __('New In'), |
| 212 | 212 | ], |
| 213 | - fn () => Period::all()->pluck('name', 'id')->toArray(), |
|
| 214 | - function ($value) { |
|
| 213 | + fn() => Period::all()->pluck('name', 'id')->toArray(), |
|
| 214 | + function($value) { |
|
| 215 | 215 | CRUD::addClause('newInPeriod', $value); |
| 216 | 216 | } |
| 217 | 217 | ); |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | 'name' => 'institution_id', |
| 222 | 222 | 'type' => 'select2', |
| 223 | 223 | 'label' => __('Institution'), |
| 224 | - ], fn () => Institution::all()->pluck('name', 'id')->toArray(), function ($value) { |
|
| 224 | + ], fn() => Institution::all()->pluck('name', 'id')->toArray(), function($value) { |
|
| 225 | 225 | $this->crud->addClause('where', 'institution_id', $value); |
| 226 | 226 | }); |
| 227 | 227 | |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | 'name' => 'status_type_id', |
| 230 | 230 | 'type' => 'select2', |
| 231 | 231 | 'label' => __('Lead Status'), |
| 232 | - ], fn () => LeadType::all()->pluck('name', 'id')->toArray(), function ($value) { |
|
| 232 | + ], fn() => LeadType::all()->pluck('name', 'id')->toArray(), function($value) { |
|
| 233 | 233 | if ($value === '4') { |
| 234 | 234 | $this->crud->query = $this->crud->query->where('lead_type_id', $value)->orWhere('lead_type_id', null); |
| 235 | 235 | } else { |
@@ -350,8 +350,8 @@ discard block |
||
| 350 | 350 | $username_parts = array_filter(explode(' ', strtolower($fullName))); |
| 351 | 351 | $username_parts = array_slice($username_parts, -2); |
| 352 | 352 | |
| 353 | - $part1 = (! empty($username_parts[0])) ? substr($username_parts[0], 0, 3) : ''; |
|
| 354 | - $part2 = (! empty($username_parts[1])) ? substr($username_parts[1], 0, 8) : ''; |
|
| 353 | + $part1 = (!empty($username_parts[0])) ? substr($username_parts[0], 0, 3) : ''; |
|
| 354 | + $part2 = (!empty($username_parts[1])) ? substr($username_parts[1], 0, 8) : ''; |
|
| 355 | 355 | $part3 = random_int(999, 9999); |
| 356 | 356 | |
| 357 | 357 | $username = $part1.$part2.$part3; //str_shuffle to randomly shuffle all characters |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | { |
| 440 | 440 | $student = Student::findOrFail($student); |
| 441 | 441 | |
| 442 | - if (! backpack_user()->isTeacher() && ! backpack_user()->can('enrollments.view')) { |
|
| 442 | + if (!backpack_user()->isTeacher() && !backpack_user()->can('enrollments.view')) { |
|
| 443 | 443 | abort(403); |
| 444 | 444 | } |
| 445 | 445 | |
@@ -46,10 +46,10 @@ discard block |
||
| 46 | 46 | 'attribute' => 'lastname', |
| 47 | 47 | 'model' => User::class, |
| 48 | 48 | 'orderable' => true, |
| 49 | - 'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
| 49 | + 'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
| 50 | 50 | ->orderBy('users.lastname', $columnDirection)->select('students.*'), |
| 51 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 52 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 51 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 52 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 53 | 53 | $q->where('lastname', 'like', '%'.$searchTerm.'%'); |
| 54 | 54 | }); |
| 55 | 55 | }, |
@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | 'attribute' => 'firstname', |
| 65 | 65 | 'model' => User::class, |
| 66 | 66 | 'orderable' => true, |
| 67 | - 'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'teachers.id') |
|
| 67 | + 'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'teachers.id') |
|
| 68 | 68 | ->orderBy('users.firstname', $columnDirection)->select('teachers.*'), |
| 69 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 70 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 69 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 70 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 71 | 71 | $q->where('firstname', 'like', '%'.$searchTerm.'%'); |
| 72 | 72 | }); |
| 73 | 73 | }, |
@@ -81,10 +81,10 @@ discard block |
||
| 81 | 81 | 'attribute' => 'email', |
| 82 | 82 | 'model' => User::class, |
| 83 | 83 | 'orderable' => true, |
| 84 | - 'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'teachers.id') |
|
| 84 | + 'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'teachers.id') |
|
| 85 | 85 | ->orderBy('users.email', $columnDirection)->select('teachers.*'), |
| 86 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 87 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 86 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 87 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 88 | 88 | $q->where('email', 'like', '%'.$searchTerm.'%'); |
| 89 | 89 | }); |
| 90 | 90 | }, |
@@ -181,8 +181,8 @@ discard block |
||
| 181 | 181 | $username_parts = array_filter(explode(' ', strtolower($fullName))); |
| 182 | 182 | $username_parts = array_slice($username_parts, -2); |
| 183 | 183 | |
| 184 | - $part1 = (! empty($username_parts[0])) ? substr($username_parts[0], 0, 3) : ''; |
|
| 185 | - $part2 = (! empty($username_parts[1])) ? substr($username_parts[1], 0, 8) : ''; |
|
| 184 | + $part1 = (!empty($username_parts[0])) ? substr($username_parts[0], 0, 3) : ''; |
|
| 185 | + $part2 = (!empty($username_parts[1])) ? substr($username_parts[1], 0, 8) : ''; |
|
| 186 | 186 | $part3 = random_int(999, 9999); |
| 187 | 187 | |
| 188 | 188 | $username = $part1.$part2.$part3; //str_shuffle to randomly shuffle all characters |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | 'label' => 'Name', |
| 40 | 40 | 'type' => 'text', ]); |
| 41 | 41 | |
| 42 | - CRUD::addField([ // Select2Multiple = n-n relationship (with pivot table) |
|
| 42 | + CRUD::addField([// Select2Multiple = n-n relationship (with pivot table) |
|
| 43 | 43 | 'label' => __('Grade Types'), |
| 44 | 44 | 'type' => 'select2_multiple', |
| 45 | 45 | 'name' => 'gradeTypes', |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | // show Select All and Clear buttons? |
| 55 | 55 | ]); |
| 56 | 56 | |
| 57 | - CRUD::addField([ // Select2Multiple = n-n relationship (with pivot table) |
|
| 57 | + CRUD::addField([// Select2Multiple = n-n relationship (with pivot table) |
|
| 58 | 58 | 'label' => __('Skills'), |
| 59 | 59 | 'type' => 'select2_multiple', |
| 60 | 60 | 'name' => 'skills', |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | $q->where('firstname', 'like', '%'.$searchTerm.'%') |
| 59 | 59 | ->orWhere('lastname', 'like', '%'.$searchTerm.'%') |
| 60 | 60 | ->orWhere('email', 'like', '%'.$searchTerm.'%') |
| 61 | - ->orWhere('idnumber', 'like', '%'.$searchTerm.'%'); |
|
| 61 | + ->orWhere('idnumber', 'like', '%'.$searchTerm.'%'); |
|
| 62 | 62 | }); |
| 63 | 63 | }); |
| 64 | 64 | }, |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | 'type' => 'select', |
| 53 | 53 | 'name' => 'student', |
| 54 | 54 | 'attribute' => 'name', |
| 55 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 56 | - $query->orWhereHas('student', function ($q) use ($searchTerm) { |
|
| 57 | - $q->WhereHas('user', function ($q) use ($searchTerm) { |
|
| 55 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 56 | + $query->orWhereHas('student', function($q) use ($searchTerm) { |
|
| 57 | + $q->WhereHas('user', function($q) use ($searchTerm) { |
|
| 58 | 58 | $q->where('firstname', 'like', '%'.$searchTerm.'%') |
| 59 | 59 | ->orWhere('lastname', 'like', '%'.$searchTerm.'%') |
| 60 | 60 | ->orWhere('email', 'like', '%'.$searchTerm.'%') |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | 'label' => __('No Result'), |
| 95 | 95 | ], |
| 96 | 96 | false, |
| 97 | - function () { |
|
| 97 | + function() { |
|
| 98 | 98 | CRUD::addClause('noResult'); |
| 99 | 99 | } |
| 100 | 100 | ); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | 'label' => __('Hide Parents'), |
| 107 | 107 | ], |
| 108 | 108 | false, |
| 109 | - function () { |
|
| 109 | + function() { |
|
| 110 | 110 | CRUD::addClause('real'); |
| 111 | 111 | } |
| 112 | 112 | ); |
@@ -115,16 +115,16 @@ discard block |
||
| 115 | 115 | 'name' => 'period_id', |
| 116 | 116 | 'type' => 'select2', |
| 117 | 117 | 'label' => __('Period'), |
| 118 | - ], fn () => Period::all()->pluck('name', 'id')->toArray(), function ($value) { |
|
| 118 | + ], fn() => Period::all()->pluck('name', 'id')->toArray(), function($value) { |
|
| 119 | 119 | CRUD::addClause('period', $value); |
| 120 | 120 | }); |
| 121 | 121 | |
| 122 | - CRUD::addFilter([ // select2_multiple filter |
|
| 122 | + CRUD::addFilter([// select2_multiple filter |
|
| 123 | 123 | 'name' => 'result', |
| 124 | 124 | 'type' => 'select2', |
| 125 | 125 | 'label' => __('Result'), |
| 126 | - ], fn () => ResultType::all()->pluck('name', 'id')->toArray(), function ($value) { |
|
| 127 | - $this->crud->query = $this->crud->query->whereHas('result', function ($query) use ($value) { |
|
| 126 | + ], fn() => ResultType::all()->pluck('name', 'id')->toArray(), function($value) { |
|
| 127 | + $this->crud->query = $this->crud->query->whereHas('result', function($query) use ($value) { |
|
| 128 | 128 | $query->where('result_type_id', $value); |
| 129 | 129 | }); |
| 130 | 130 | }); |