@@ -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', |
@@ -116,39 +116,39 @@ discard block |
||
116 | 116 | 'name' => 'from_to', |
117 | 117 | 'label'=> __('Date range'), |
118 | 118 | ], |
119 | - false, |
|
120 | - function ($value) { // if the filter is active, apply these constraints |
|
121 | - $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR); |
|
122 | - |
|
123 | - if ($dates->from) { |
|
124 | - CRUD::addClause('where', 'start', '>=', $dates->from); |
|
125 | - } |
|
126 | - if ($dates->to) { |
|
127 | - CRUD::addClause('where', 'start', '<=', $dates->to.' 23:59:59'); |
|
128 | - } |
|
129 | - }); |
|
119 | + false, |
|
120 | + function ($value) { // if the filter is active, apply these constraints |
|
121 | + $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR); |
|
122 | + |
|
123 | + if ($dates->from) { |
|
124 | + CRUD::addClause('where', 'start', '>=', $dates->from); |
|
125 | + } |
|
126 | + if ($dates->to) { |
|
127 | + CRUD::addClause('where', 'start', '<=', $dates->to.' 23:59:59'); |
|
128 | + } |
|
129 | + }); |
|
130 | 130 | |
131 | 131 | CRUD::addFilter([ |
132 | 132 | 'type' => 'simple', |
133 | 133 | 'name' => 'orphan', |
134 | 134 | 'label'=> __('Events with no course'), |
135 | 135 | ], |
136 | - false, |
|
137 | - function ($value) { // if the filter is active, apply these constraints |
|
138 | - $this->crud->query->where('course_id', null); |
|
139 | - }, |
|
140 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
141 | - }); |
|
136 | + false, |
|
137 | + function ($value) { // if the filter is active, apply these constraints |
|
138 | + $this->crud->query->where('course_id', null); |
|
139 | + }, |
|
140 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
141 | + }); |
|
142 | 142 | |
143 | 143 | CRUD::addFilter([ |
144 | 144 | 'type' => 'simple', |
145 | 145 | 'name' => 'unassigned', |
146 | 146 | 'label'=> __('Events with no teacher'), |
147 | 147 | ], |
148 | - false, |
|
149 | - function ($value) { // if the filter is active, apply these constraints |
|
150 | - CRUD::addClause('unassigned'); |
|
151 | - }); |
|
148 | + false, |
|
149 | + function ($value) { // if the filter is active, apply these constraints |
|
150 | + CRUD::addClause('unassigned'); |
|
151 | + }); |
|
152 | 152 | |
153 | 153 | CRUD::addFilter([ // select2 filter |
154 | 154 | 'name' => 'teacher_id', |
@@ -157,8 +157,8 @@ discard block |
||
157 | 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) |
|
161 | - }); |
|
160 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
161 | + }); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | public function store(Request $request) |
@@ -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 |