@@ -85,17 +85,17 @@ discard block |
||
| 85 | 85 | ], |
| 86 | 86 | ]); |
| 87 | 87 | |
| 88 | - CRUD::addFilter([ // simple filter |
|
| 88 | + CRUD::addFilter([// simple filter |
|
| 89 | 89 | 'type' => 'simple', |
| 90 | 90 | 'name' => 'action', |
| 91 | 91 | 'label'=> 'Action', |
| 92 | 92 | ], |
| 93 | 93 | false, |
| 94 | - function () { // if the filter is active |
|
| 94 | + function() { // if the filter is active |
|
| 95 | 95 | CRUD::addClause('where', 'action', true); |
| 96 | 96 | }); |
| 97 | 97 | |
| 98 | - CRUD::addFilter([ // dropdown filter |
|
| 98 | + CRUD::addFilter([// dropdown filter |
|
| 99 | 99 | 'name' => 'type', |
| 100 | 100 | 'type' => 'dropdown', |
| 101 | 101 | 'label'=> 'Type', |
@@ -106,10 +106,10 @@ discard block |
||
| 106 | 106 | Invoice::class => 'Invoice', |
| 107 | 107 | Result::class => 'Result', |
| 108 | 108 | |
| 109 | - ], function ($value) { // if the filter is active |
|
| 109 | + ], function($value) { // if the filter is active |
|
| 110 | 110 | CRUD::addClause('where', 'commentable_type', '=', $value); |
| 111 | 111 | }, |
| 112 | - function () { // if the filter is not active |
|
| 112 | + function() { // if the filter is not active |
|
| 113 | 113 | CRUD::addClause('where', 'commentable_type', '=', Student::class); |
| 114 | 114 | $this->crud->getRequest()->request->add(['commentable_type' => Student::class]); // to make the filter look active |
| 115 | 115 | }); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | CRUD::setModel(Invoice::class); |
| 30 | 30 | CRUD::setRoute(config('backpack.base.route_prefix').'/invoice'); |
| 31 | 31 | CRUD::setEntityNameStrings('invoice', 'invoices'); |
| 32 | - if (! config('invoicing.price_categories_enabled')) { |
|
| 32 | + if (!config('invoicing.price_categories_enabled')) { |
|
| 33 | 33 | $this->crud->addButtonFromView('top', 'createInvoice', 'createInvoice', 'start'); |
| 34 | 34 | } |
| 35 | 35 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | { |
| 95 | 95 | $invoice = Invoice::findOrFail($id)->load('payments'); |
| 96 | 96 | |
| 97 | - if (! backpack_user()->can('enrollments.edit')) { |
|
| 97 | + if (!backpack_user()->can('enrollments.edit')) { |
|
| 98 | 98 | abort(403); |
| 99 | 99 | } |
| 100 | 100 | |
@@ -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', |
@@ -111,13 +111,13 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | ]); |
| 113 | 113 | |
| 114 | - CRUD::addFilter([ // daterange filter |
|
| 114 | + CRUD::addFilter([// daterange filter |
|
| 115 | 115 | 'type' => 'date_range', |
| 116 | 116 | 'name' => 'from_to', |
| 117 | 117 | 'label'=> __('Date range'), |
| 118 | 118 | ], |
| 119 | 119 | false, |
| 120 | - function ($value) { // if the filter is active, apply these constraints |
|
| 120 | + function($value) { // if the filter is active, apply these constraints |
|
| 121 | 121 | $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR); |
| 122 | 122 | |
| 123 | 123 | if ($dates->from) { |
@@ -134,10 +134,10 @@ discard block |
||
| 134 | 134 | 'label'=> __('Events with no course'), |
| 135 | 135 | ], |
| 136 | 136 | false, |
| 137 | - function ($value) { // if the filter is active, apply these constraints |
|
| 137 | + function($value) { // if the filter is active, apply these constraints |
|
| 138 | 138 | $this->crud->query->where('course_id', null); |
| 139 | 139 | }, |
| 140 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 140 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 141 | 141 | }); |
| 142 | 142 | |
| 143 | 143 | CRUD::addFilter([ |
@@ -146,18 +146,18 @@ discard block |
||
| 146 | 146 | 'label'=> __('Events with no teacher'), |
| 147 | 147 | ], |
| 148 | 148 | false, |
| 149 | - function ($value) { // if the filter is active, apply these constraints |
|
| 149 | + function($value) { // if the filter is active, apply these constraints |
|
| 150 | 150 | CRUD::addClause('unassigned'); |
| 151 | 151 | }); |
| 152 | 152 | |
| 153 | - CRUD::addFilter([ // select2 filter |
|
| 153 | + CRUD::addFilter([// select2 filter |
|
| 154 | 154 | 'name' => 'teacher_id', |
| 155 | 155 | 'type' => 'select2', |
| 156 | 156 | 'label'=> __('Teacher'), |
| 157 | - ], fn () => Teacher::all()->pluck('name', 'id')->toArray(), function ($value) { // if the filter is active |
|
| 157 | + ], fn() => Teacher::all()->pluck('name', 'id')->toArray(), function($value) { // if the filter is active |
|
| 158 | 158 | CRUD::addClause('where', 'teacher_id', $value); |
| 159 | 159 | }, |
| 160 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 160 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 161 | 161 | }); |
| 162 | 162 | } |
| 163 | 163 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | 'label' => __('Due Date'), |
| 50 | 50 | ], |
| 51 | 51 | false, |
| 52 | - function ($value) { // if the filter is active, apply these constraints |
|
| 52 | + function($value) { // if the filter is active, apply these constraints |
|
| 53 | 53 | $this->crud->addClause('where', 'date', '>=', Carbon::parse($value)->firstOfMonth()); |
| 54 | 54 | $this->crud->addClause('where', 'date', '<=', Carbon::parse($value)->lastOfMonth()); |
| 55 | 55 | }); |
@@ -90,11 +90,11 @@ discard block |
||
| 90 | 90 | { |
| 91 | 91 | $payment = Payment::findOrFail($id); |
| 92 | 92 | |
| 93 | - if (! backpack_user()->can('enrollments.edit')) { |
|
| 93 | + if (!backpack_user()->can('enrollments.edit')) { |
|
| 94 | 94 | abort(403); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - if (! $payment->invoice) { |
|
| 97 | + if (!$payment->invoice) { |
|
| 98 | 98 | abort(404, 'No enrollment found for this payment'); |
| 99 | 99 | } |
| 100 | 100 | |
@@ -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 | |
@@ -186,11 +186,11 @@ discard block |
||
| 186 | 186 | 'name' => 'rhythm_id', |
| 187 | 187 | 'type' => 'select2', |
| 188 | 188 | 'label'=> __('Rhythm'), |
| 189 | - ], fn () => Rhythm::all()->pluck('name', 'id')->toArray(), function ($value) { |
|
| 189 | + ], fn() => Rhythm::all()->pluck('name', 'id')->toArray(), function($value) { |
|
| 190 | 190 | // if the filter is active |
| 191 | 191 | CRUD::addClause('where', 'rhythm_id', $value); |
| 192 | 192 | }, |
| 193 | - function () { |
|
| 193 | + function() { |
|
| 194 | 194 | // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
| 195 | 195 | }); |
| 196 | 196 | |
@@ -198,11 +198,11 @@ discard block |
||
| 198 | 198 | 'name' => 'teacher_id', |
| 199 | 199 | 'type' => 'select2', |
| 200 | 200 | 'label'=> __('Teacher'), |
| 201 | - ], fn () => Teacher::all()->pluck('name', 'id')->toArray(), function ($value) { |
|
| 201 | + ], fn() => Teacher::all()->pluck('name', 'id')->toArray(), function($value) { |
|
| 202 | 202 | // if the filter is active |
| 203 | 203 | CRUD::addClause('where', 'teacher_id', $value); |
| 204 | 204 | }, |
| 205 | - function () { |
|
| 205 | + function() { |
|
| 206 | 206 | // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
| 207 | 207 | }); |
| 208 | 208 | |
@@ -210,11 +210,11 @@ discard block |
||
| 210 | 210 | 'name' => 'level_id', |
| 211 | 211 | 'type' => 'select2', |
| 212 | 212 | 'label'=> __('Level'), |
| 213 | - ], fn () => Level::all()->pluck('name', 'id')->toArray(), function ($value) { |
|
| 213 | + ], fn() => Level::all()->pluck('name', 'id')->toArray(), function($value) { |
|
| 214 | 214 | // if the filter is active |
| 215 | 215 | CRUD::addClause('where', 'level_id', $value); |
| 216 | 216 | }, |
| 217 | - function () { |
|
| 217 | + function() { |
|
| 218 | 218 | // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
| 219 | 219 | }); |
| 220 | 220 | |
@@ -223,11 +223,11 @@ discard block |
||
| 223 | 223 | 'type' => 'select2', |
| 224 | 224 | 'label'=> __('Period'), |
| 225 | 225 | ], |
| 226 | - fn () => \App\Models\Period::all()->sortByDesc('id')->pluck('name', 'id')->toArray(), |
|
| 227 | - function ($value) { // if the filter is active |
|
| 226 | + fn() => \App\Models\Period::all()->sortByDesc('id')->pluck('name', 'id')->toArray(), |
|
| 227 | + function($value) { // if the filter is active |
|
| 228 | 228 | CRUD::addClause('where', 'period_id', $value); |
| 229 | 229 | }, |
| 230 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 230 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 231 | 231 | $period = \App\Models\Period::get_default_period()->id; |
| 232 | 232 | CRUD::addClause('where', 'period_id', $period); |
| 233 | 233 | $this->crud->getRequest()->request->add(['period_id' => $period]); // to make the filter look active |
@@ -235,13 +235,13 @@ discard block |
||
| 235 | 235 | ); |
| 236 | 236 | |
| 237 | 237 | CRUD::addFilter( |
| 238 | - [ // add a "simple" filter called Draft |
|
| 238 | + [// add a "simple" filter called Draft |
|
| 239 | 239 | 'type' => 'simple', |
| 240 | 240 | 'name' => 'parent', |
| 241 | 241 | 'label'=> __('Hide Children Courses'), |
| 242 | 242 | ], |
| 243 | 243 | false, |
| 244 | - function () { |
|
| 244 | + function() { |
|
| 245 | 245 | CRUD::addClause('parent'); |
| 246 | 246 | } |
| 247 | 247 | ); |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | 'label' => __('Start'), |
| 253 | 253 | ], |
| 254 | 254 | false, |
| 255 | - function ($value) { // if the filter is active, apply these constraints |
|
| 255 | + function($value) { // if the filter is active, apply these constraints |
|
| 256 | 256 | $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR); |
| 257 | 257 | $this->crud->addClause('where', 'start_date', '>=', $dates->from); |
| 258 | 258 | $this->crud->addClause('where', 'start_date', '<=', $dates->to.' 23:59:59'); |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | 'label' => __('End'), |
| 265 | 265 | ], |
| 266 | 266 | false, |
| 267 | - function ($value) { // if the filter is active, apply these constraints |
|
| 267 | + function($value) { // if the filter is active, apply these constraints |
|
| 268 | 268 | $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR); |
| 269 | 269 | $this->crud->addClause('where', 'end_date', '>=', $dates->from); |
| 270 | 270 | $this->crud->addClause('where', 'end_date', '<=', $dates->to.' 23:59:59'); |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | 'tab' => __('Course info'), |
| 361 | 361 | ], |
| 362 | 362 | |
| 363 | - [ // repeatable |
|
| 363 | + [// repeatable |
|
| 364 | 364 | 'name' => 'sublevels', |
| 365 | 365 | 'label' => __('Course sublevels'), |
| 366 | 366 | 'type' => 'repeatable', |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | 'default' => Period::get_enrollments_period()->end, |
| 518 | 518 | ], |
| 519 | 519 | |
| 520 | - [ // repeatable |
|
| 520 | + [// repeatable |
|
| 521 | 521 | 'name' => 'times', |
| 522 | 522 | 'label' => __('Course Schedule'), |
| 523 | 523 | 'type' => 'repeatable', |
@@ -580,14 +580,14 @@ discard block |
||
| 580 | 580 | 'init_rows' => 0, // number of empty rows to be initialized, by default 1 |
| 581 | 581 | ], |
| 582 | 582 | |
| 583 | - [ // view |
|
| 583 | + [// view |
|
| 584 | 584 | 'name' => 'custom-ajax-button', |
| 585 | 585 | 'type' => 'view', |
| 586 | 586 | 'view' => 'courses/schedule-preset-alert', |
| 587 | 587 | 'tab' => __('Schedule'), |
| 588 | 588 | ], |
| 589 | 589 | |
| 590 | - [ // select_from_array |
|
| 590 | + [// select_from_array |
|
| 591 | 591 | 'name' => 'schedulepreset', |
| 592 | 592 | 'label' => __('Schedule Preset'), |
| 593 | 593 | 'type' => 'select_from_array', |
@@ -611,7 +611,7 @@ discard block |
||
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | if ($this->crud->getCurrentEntry()->children->count() > 0) { |
| 614 | - CRUD::addField([ // view |
|
| 614 | + CRUD::addField([// view |
|
| 615 | 615 | 'name' => 'custom-ajax-button', |
| 616 | 616 | 'type' => 'view', |
| 617 | 617 | 'view' => 'courses/parent-course-alert', |
@@ -619,7 +619,7 @@ discard block |
||
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | if ($this->crud->getCurrentEntry()->parent_course_id !== null) { |
| 622 | - CRUD::addField([ // view |
|
| 622 | + CRUD::addField([// view |
|
| 623 | 623 | 'name' => 'custom-ajax-button', |
| 624 | 624 | 'type' => 'view', |
| 625 | 625 | 'view' => 'courses/child-course-alert', |
@@ -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', |