@@ -24,14 +24,14 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | $rooms = Room::all()->toArray(); |
| 26 | 26 | |
| 27 | - $rooms = array_map(fn ($room) => [ |
|
| 27 | + $rooms = array_map(fn($room) => [ |
|
| 28 | 28 | 'id' => $room['id'], |
| 29 | 29 | 'title' => $room['name'], |
| 30 | 30 | ], $rooms); |
| 31 | 31 | |
| 32 | 32 | array_push($rooms, ['id' => 'tbd', 'title' => 'Unassigned']); |
| 33 | 33 | |
| 34 | - $events = array_map(fn ($event) => [ |
|
| 34 | + $events = array_map(fn($event) => [ |
|
| 35 | 35 | 'title' => $event['name'], |
| 36 | 36 | 'resourceId' => $event['room_id'], |
| 37 | 37 | 'start' => $event['start'], |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $unassigned_events = Event::where('room_id', null)->get()->toArray(); |
| 45 | 45 | |
| 46 | - $unassigned_events = array_map(fn ($event) => [ |
|
| 46 | + $unassigned_events = array_map(fn($event) => [ |
|
| 47 | 47 | 'title' => $event['name'], |
| 48 | 48 | 'resourceId' => 'tbd', |
| 49 | 49 | 'start' => $event['start'], |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | public function show(Room $room) |
| 67 | 67 | { |
| 68 | 68 | $events = $room->events->toArray(); |
| 69 | - $events = array_map(fn ($event) => [ |
|
| 69 | + $events = array_map(fn($event) => [ |
|
| 70 | 70 | 'title' => $event['name'], |
| 71 | 71 | 'start' => $event['start'], |
| 72 | 72 | 'end' => $event['end'], |
@@ -92,7 +92,7 @@ |
||
| 92 | 92 | 'priceB' => $enrollment->course->price_b, |
| 93 | 93 | 'priceC' => $enrollment->course->price_c, |
| 94 | 94 | ]), |
| 95 | - 'studentPriceCategory' => $enrollment->student?->price_category, |
|
| 95 | + 'studentPriceCategory' => $enrollment->student ? ->price_category, |
|
| 96 | 96 | ] |
| 97 | 97 | ); |
| 98 | 98 | } |
@@ -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; |
@@ -90,10 +90,10 @@ discard block |
||
| 90 | 90 | 'name' => 'action', |
| 91 | 91 | 'label'=> 'Action', |
| 92 | 92 | ], |
| 93 | - false, |
|
| 94 | - function () { // if the filter is active |
|
| 95 | - CRUD::addClause('where', 'action', true); |
|
| 96 | - }); |
|
| 93 | + false, |
|
| 94 | + function () { // if the filter is active |
|
| 95 | + CRUD::addClause('where', 'action', true); |
|
| 96 | + }); |
|
| 97 | 97 | |
| 98 | 98 | CRUD::addFilter([ // dropdown filter |
| 99 | 99 | 'name' => 'type', |
@@ -109,10 +109,10 @@ discard block |
||
| 109 | 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 |
|
| 113 | - CRUD::addClause('where', 'commentable_type', '=', Student::class); |
|
| 114 | - $this->crud->getRequest()->request->add(['commentable_type' => Student::class]); // to make the filter look active |
|
| 115 | - }); |
|
| 112 | + function () { // if the filter is not active |
|
| 113 | + CRUD::addClause('where', 'commentable_type', '=', Student::class); |
|
| 114 | + $this->crud->getRequest()->request->add(['commentable_type' => Student::class]); // to make the filter look active |
|
| 115 | + }); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | public function setupUpdateOperation() |
@@ -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', |
@@ -74,20 +74,20 @@ |
||
| 74 | 74 | ], fn () => Teacher::all()->pluck('name', 'id')->toArray(), function ($value) { // if the filter is active |
| 75 | 75 | CRUD::addClause('where', 'teacher_id', $value); |
| 76 | 76 | }, |
| 77 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 78 | - }); |
|
| 77 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 78 | + }); |
|
| 79 | 79 | |
| 80 | 80 | CRUD::addFilter([ // daterange filter |
| 81 | 81 | 'type' => 'date_range', |
| 82 | 82 | 'name' => 'from_to', |
| 83 | 83 | 'label'=> __('Date range'), |
| 84 | 84 | ], |
| 85 | - false, |
|
| 86 | - function ($value) { // if the filter is active, apply these constraints |
|
| 87 | - $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR); |
|
| 88 | - CRUD::addClause('where', 'date', '>=', $dates->from); |
|
| 89 | - CRUD::addClause('where', 'date', '<=', $dates->to.' 23:59:59'); |
|
| 90 | - }); |
|
| 85 | + false, |
|
| 86 | + function ($value) { // if the filter is active, apply these constraints |
|
| 87 | + $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR); |
|
| 88 | + CRUD::addClause('where', 'date', '>=', $dates->from); |
|
| 89 | + CRUD::addClause('where', 'date', '<=', $dates->to.' 23:59:59'); |
|
| 90 | + }); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | protected function setupCreateOperation() |
@@ -67,23 +67,23 @@ discard block |
||
| 67 | 67 | ], |
| 68 | 68 | ]); |
| 69 | 69 | |
| 70 | - CRUD::addFilter([ // select2 filter |
|
| 70 | + CRUD::addFilter([// select2 filter |
|
| 71 | 71 | 'name' => 'teacher_id', |
| 72 | 72 | 'type' => 'select2', |
| 73 | 73 | 'label'=> __('Teacher'), |
| 74 | - ], fn () => Teacher::all()->pluck('name', 'id')->toArray(), function ($value) { // if the filter is active |
|
| 74 | + ], fn() => Teacher::all()->pluck('name', 'id')->toArray(), function($value) { // if the filter is active |
|
| 75 | 75 | CRUD::addClause('where', 'teacher_id', $value); |
| 76 | 76 | }, |
| 77 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 77 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 78 | 78 | }); |
| 79 | 79 | |
| 80 | - CRUD::addFilter([ // daterange filter |
|
| 80 | + CRUD::addFilter([// daterange filter |
|
| 81 | 81 | 'type' => 'date_range', |
| 82 | 82 | 'name' => 'from_to', |
| 83 | 83 | 'label'=> __('Date range'), |
| 84 | 84 | ], |
| 85 | 85 | false, |
| 86 | - function ($value) { // if the filter is active, apply these constraints |
|
| 86 | + function($value) { // if the filter is active, apply these constraints |
|
| 87 | 87 | $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR); |
| 88 | 88 | CRUD::addClause('where', 'date', '>=', $dates->from); |
| 89 | 89 | CRUD::addClause('where', 'date', '<=', $dates->to.' 23:59:59'); |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | 'model' => LeaveType::class, // foreign key model |
| 116 | 116 | ], |
| 117 | 117 | |
| 118 | - [ // date_range |
|
| 118 | + [// date_range |
|
| 119 | 119 | 'name' => ['start_date', 'end_date'], // db columns for start_date & end_date |
| 120 | 120 | 'label' => 'Event Date Range', |
| 121 | 121 | 'type' => 'date_range', |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | 'model' => LeaveType::class, // foreign key model |
| 160 | 160 | ], |
| 161 | 161 | |
| 162 | - [ // datepicker |
|
| 162 | + [// datepicker |
|
| 163 | 163 | 'name' => 'date', |
| 164 | 164 | 'label' => 'Event Date', |
| 165 | 165 | 'type' => 'date', |