@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $events = Event::with('course') |
26 | 26 | ->where('start', '>', Carbon::now()->subDays(30))->where('end', '<', Carbon::now()->addDays(30))->orderBy('id', 'desc') // TODO optimize this. |
27 | 27 | ->get() |
28 | - ->map(fn ($event) => [ |
|
28 | + ->map(fn($event) => [ |
|
29 | 29 | 'title' => $event->name ?? '', |
30 | 30 | 'resourceId' => $event->teacher_id, |
31 | 31 | 'start' => $event->start, |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | $teachers = Teacher::all()->toArray(); |
39 | 39 | |
40 | - $teachers = array_map(fn ($teacher) => [ |
|
40 | + $teachers = array_map(fn($teacher) => [ |
|
41 | 41 | 'id' => $teacher['id'], |
42 | 42 | 'title' => $teacher['name'] ?? '', |
43 | 43 | ], $teachers); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | array_push($teachers, ['id' => 'tbd', |
46 | 46 | 'title' => 'Unassigned', ]); |
47 | 47 | |
48 | - $unassigned_events = Event::unassigned()->get()->map(fn ($event) => [ |
|
48 | + $unassigned_events = Event::unassigned()->get()->map(fn($event) => [ |
|
49 | 49 | 'title' => $event->name ?? '', |
50 | 50 | 'resourceId' => 'tbd', |
51 | 51 | 'start' => $event->start, |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | 'borderColor' => $event->color, |
56 | 56 | ]); |
57 | 57 | |
58 | - $leaves = Leave::orderBy('date', 'desc')->limit(10000)->get()->map(fn ($event) => [ |
|
58 | + $leaves = Leave::orderBy('date', 'desc')->limit(10000)->get()->map(fn($event) => [ |
|
59 | 59 | 'title' => $event->leaveType->name ?? 'ABS', |
60 | 60 | // todo fix |
61 | 61 | 'resourceId' => $event['teacher_id'], |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | abort(403); |
83 | 83 | } |
84 | 84 | |
85 | - $events = $teacher->events->map(fn ($event) => [ |
|
85 | + $events = $teacher->events->map(fn($event) => [ |
|
86 | 86 | 'title' => $event['name'], |
87 | 87 | 'start' => $event['start'], |
88 | 88 | 'end' => $event['end'], |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | 'borderColor' => $event['color'], |
91 | 91 | ]); |
92 | 92 | |
93 | - $leaves = $teacher->leaves->map(fn ($event) => [ |
|
93 | + $leaves = $teacher->leaves->map(fn($event) => [ |
|
94 | 94 | 'title' => $event->leaveType->name ?? 'vacances', |
95 | 95 | // todo fix |
96 | 96 | 'start' => $event['date'], |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | 'attribute' => 'lastname', |
49 | 49 | 'label' => __('Last Name'), |
50 | 50 | 'type' => 'relationship', |
51 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
52 | - $query->orWhereHas('enrollment', function ($q) use ($searchTerm) { |
|
53 | - $q->whereHas('user', function ($q) use ($searchTerm) { |
|
51 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
52 | + $query->orWhereHas('enrollment', function($q) use ($searchTerm) { |
|
53 | + $q->whereHas('user', function($q) use ($searchTerm) { |
|
54 | 54 | $q->where('lastname', 'like', '%'.$searchTerm.'%'); |
55 | 55 | }); |
56 | 56 | }); |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | 'attribute' => 'firstname', |
64 | 64 | 'label' => __('First Name'), |
65 | 65 | 'type' => 'relationship', |
66 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
67 | - $query->orWhereHas('enrollment', function ($q) use ($searchTerm) { |
|
68 | - $q->whereHas('user', function ($q) use ($searchTerm) { |
|
66 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
67 | + $query->orWhereHas('enrollment', function($q) use ($searchTerm) { |
|
68 | + $q->whereHas('user', function($q) use ($searchTerm) { |
|
69 | 69 | $q->where('firstname', 'like', '%'.$searchTerm.'%'); |
70 | 70 | }); |
71 | 71 | }); |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | 'attribute' => 'email', |
79 | 79 | 'label' => __('Email'), |
80 | 80 | 'type' => 'relationship', |
81 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
82 | - $query->orWhereHas('enrollment', function ($q) use ($searchTerm) { |
|
83 | - $q->whereHas('user', function ($q) use ($searchTerm) { |
|
81 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
82 | + $query->orWhereHas('enrollment', function($q) use ($searchTerm) { |
|
83 | + $q->whereHas('user', function($q) use ($searchTerm) { |
|
84 | 84 | $q->where('email', 'like', '%'.$searchTerm.'%'); |
85 | 85 | }); |
86 | 86 | }); |
@@ -113,11 +113,11 @@ discard block |
||
113 | 113 | 'type' => 'select2', |
114 | 114 | 'label' => __('Status'), |
115 | 115 | ], |
116 | - fn () => [ |
|
116 | + fn() => [ |
|
117 | 117 | 1 => __('Pending'), |
118 | 118 | 2 => __('Paid'), |
119 | 119 | ], |
120 | - function ($value) { |
|
120 | + function($value) { |
|
121 | 121 | CRUD::addClause('status', $value); |
122 | 122 | } |
123 | 123 | ); |
@@ -97,14 +97,14 @@ discard block |
||
97 | 97 | |
98 | 98 | CRUD::addColumns([['name' => 'id', |
99 | 99 | 'label' => 'ID', |
100 | - 'wrapper' => ['element' => function ($crud, $column, $entry) { |
|
100 | + 'wrapper' => ['element' => function($crud, $column, $entry) { |
|
101 | 101 | return $entry->status_id > 2 ? 'del' : 'span'; |
102 | 102 | }], ], |
103 | 103 | |
104 | 104 | ['label' => __('ID number'), |
105 | 105 | 'type' => 'text', |
106 | 106 | 'name' => 'student.idnumber', |
107 | - 'wrapper' => ['element' => function ($crud, $column, $entry) { |
|
107 | + 'wrapper' => ['element' => function($crud, $column, $entry) { |
|
108 | 108 | return $entry->status_id > 2 ? 'del' : 'span'; |
109 | 109 | }], ], |
110 | 110 | |
@@ -113,17 +113,17 @@ discard block |
||
113 | 113 | 'attribute' => 'lastname', |
114 | 114 | 'label' => __('Last Name'), |
115 | 115 | 'type' => 'relationship', |
116 | - 'wrapper' => ['element' => function ($crud, $column, $entry) { |
|
116 | + 'wrapper' => ['element' => function($crud, $column, $entry) { |
|
117 | 117 | return $entry->status_id > 2 ? 'del' : 'span'; |
118 | 118 | }], |
119 | 119 | 'orderable' => true, |
120 | - 'orderLogic' => function ($query, $column, $columnDirection) { |
|
120 | + 'orderLogic' => function($query, $column, $columnDirection) { |
|
121 | 121 | return $query->leftJoin('users', 'enrollments.student_id', '=', 'users.id') |
122 | 122 | ->orderBy('users.lastname', $columnDirection)->select('enrollments.*'); |
123 | 123 | }, |
124 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
125 | - $query->orWhereHas('student', function ($q) use ($searchTerm) { |
|
126 | - $q->whereHas('user', function ($q) use ($searchTerm) { |
|
124 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
125 | + $query->orWhereHas('student', function($q) use ($searchTerm) { |
|
126 | + $q->whereHas('user', function($q) use ($searchTerm) { |
|
127 | 127 | $q->where('lastname', 'like', '%'.$searchTerm.'%'); |
128 | 128 | }); |
129 | 129 | }); |
@@ -135,17 +135,17 @@ discard block |
||
135 | 135 | 'attribute' => 'firstname', |
136 | 136 | 'label' => __('First Name'), |
137 | 137 | 'type' => 'relationship', |
138 | - 'wrapper' => ['element' => function ($crud, $column, $entry) { |
|
138 | + 'wrapper' => ['element' => function($crud, $column, $entry) { |
|
139 | 139 | return $entry->status_id > 2 ? 'del' : 'span'; |
140 | 140 | }], |
141 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
142 | - $query->orWhereHas('student', function ($q) use ($searchTerm) { |
|
143 | - $q->whereHas('user', function ($q) use ($searchTerm) { |
|
141 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
142 | + $query->orWhereHas('student', function($q) use ($searchTerm) { |
|
143 | + $q->whereHas('user', function($q) use ($searchTerm) { |
|
144 | 144 | $q->where('firstname', 'like', '%'.$searchTerm.'%'); |
145 | 145 | }); |
146 | 146 | }); |
147 | 147 | }, |
148 | - 'orderLogic' => function ($query, $column, $columnDirection) { |
|
148 | + 'orderLogic' => function($query, $column, $columnDirection) { |
|
149 | 149 | return $query->leftJoin('users', 'enrollments.student_id', '=', 'users.id') |
150 | 150 | ->orderBy('users.firstname', $columnDirection)->select('enrollments.*'); |
151 | 151 | }, |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | 'name' => 'course.period', |
170 | 170 | 'label' => __('Period'), |
171 | 171 | 'attribute' => 'name', |
172 | - 'orderLogic' => function ($query, $column, $columnDirection) { |
|
172 | + 'orderLogic' => function($query, $column, $columnDirection) { |
|
173 | 173 | return $query->leftJoin('courses', 'enrollments.course_id', '=', 'courses.id') |
174 | 174 | ->orderBy('courses.period_id', $columnDirection)->select('enrollments.*'); |
175 | 175 | }, |
@@ -184,9 +184,9 @@ discard block |
||
184 | 184 | 'attribute' => 'name', |
185 | 185 | 'model' => EnrollmentStatusType::class, |
186 | 186 | 'wrapper' => ['element' => 'span', |
187 | - 'class' => function ($crud, $column, $entry) { |
|
187 | + 'class' => function($crud, $column, $entry) { |
|
188 | 188 | return 'badge badge-pill badge-'.$entry->enrollmentStatus->styling(); |
189 | - }, ], ]]); |
|
189 | + },], ]]); |
|
190 | 190 | |
191 | 191 | if (config('invoicing.allow_scheduled_payments')) { |
192 | 192 | CRUD::addColumn(['name' => 'scheduledPayments', |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | if ($this->mode === 'global') { |
233 | 233 | CRUD::addFilter(['name' => 'status_id', |
234 | 234 | 'type' => 'select2_multiple', |
235 | - 'label' => __('Status'), ], fn () => EnrollmentStatusType::all()->pluck('name', 'id')->toArray(), function ($values) { |
|
235 | + 'label' => __('Status'), ], fn() => EnrollmentStatusType::all()->pluck('name', 'id')->toArray(), function($values) { |
|
236 | 236 | foreach (json_decode($values, null, 512, JSON_THROW_ON_ERROR) as $value) { |
237 | 237 | CRUD::addClause('orWhere', 'status_id', $value); |
238 | 238 | } |
@@ -240,17 +240,17 @@ discard block |
||
240 | 240 | |
241 | 241 | CRUD::addFilter(['name' => 'period_id', |
242 | 242 | 'type' => 'select2', |
243 | - 'label' => __('Period'), ], fn () => Period::all()->pluck('name', 'id')->toArray(), function ($value) { |
|
243 | + 'label' => __('Period'), ], fn() => Period::all()->pluck('name', 'id')->toArray(), function($value) { |
|
244 | 244 | CRUD::addClause('period', $value); |
245 | 245 | }); |
246 | 246 | |
247 | 247 | CRUD::addFilter(['name' => 'scholarship', |
248 | 248 | 'type' => 'select2', |
249 | - 'label' => __('Scholarship'), ], fn () => Scholarship::all()->pluck('name', 'id')->toArray(), function ($value) { |
|
249 | + 'label' => __('Scholarship'), ], fn() => Scholarship::all()->pluck('name', 'id')->toArray(), function($value) { |
|
250 | 250 | if ($value == 'all') { |
251 | 251 | CRUD::addClause('whereHas', 'scholarships'); |
252 | 252 | } else { |
253 | - CRUD::addClause('whereHas', 'scholarships', function ($q) use ($value) { |
|
253 | + CRUD::addClause('whereHas', 'scholarships', function($q) use ($value) { |
|
254 | 254 | $q->where('scholarships.id', $value); |
255 | 255 | }); |
256 | 256 | } |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | 'model' => Course::class, |
296 | 296 | 'attribute' => 'name', |
297 | 297 | |
298 | - 'options' => (fn ($query) => $query->orderBy('level_id', 'ASC')->where('period_id', $this->crud->getCurrentEntry()->course->period_id)->get()), |
|
298 | + 'options' => (fn($query) => $query->orderBy('level_id', 'ASC')->where('period_id', $this->crud->getCurrentEntry()->course->period_id)->get()), |
|
299 | 299 | ]); |
300 | 300 | |
301 | 301 | CRUD::addField(array_merge([ |
@@ -75,7 +75,7 @@ |
||
75 | 75 | 'type' => 'relationship', |
76 | 76 | 'name' => 'category', |
77 | 77 | 'ajax' => true, |
78 | - 'inline_create' => [ // specify the entity in singular |
|
78 | + 'inline_create' => [// specify the entity in singular |
|
79 | 79 | 'entity' => 'gradetypecategory', |
80 | 80 | // the entity in singular |
81 | 81 | // OPTIONALS |
@@ -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 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | 'label' => __('Date range'), |
105 | 105 | ], |
106 | 106 | false, |
107 | - function ($value) { // if the filter is active, apply these constraints |
|
107 | + function($value) { // if the filter is active, apply these constraints |
|
108 | 108 | $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR); |
109 | 109 | |
110 | 110 | if ($dates->from) { |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | { |
148 | 148 | $invoice = Invoice::findOrFail($id)->load('payments'); |
149 | 149 | |
150 | - if (! backpack_user()->can('enrollments.edit')) { |
|
150 | + if (!backpack_user()->can('enrollments.edit')) { |
|
151 | 151 | abort(403); |
152 | 152 | } |
153 | 153 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | 'invoice' => $invoice, |
156 | 156 | 'availablePaymentMethods' => Paymentmethod::all(), |
157 | 157 | 'editable' => true, |
158 | - 'enrollment' => $invoice->enrollments->first()?->product, |
|
158 | + 'enrollment' => $invoice->enrollments->first() ? ->product, |
|
159 | 159 | 'afterSuccessUrl' => $invoice->enrollments->count() > 0 ? "/enrollment/{$invoice->enrollments->first()->product_id}/show" : '/invoice', |
160 | 160 | // TODO fix this, an invoice can theoretically contain several enrollments |
161 | 161 | ]); |
@@ -104,7 +104,7 @@ |
||
104 | 104 | 'type' => 'date', |
105 | 105 | ]); |
106 | 106 | |
107 | - CRUD::addField([ // Checkbox |
|
107 | + CRUD::addField([// Checkbox |
|
108 | 108 | 'name' => 'auto_renewal', |
109 | 109 | 'label' => __('Tacit renewal'), |
110 | 110 | 'type' => 'checkbox', |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | 'label' => 'Name', ]); |
32 | 32 | CRUD::addColumn(['name' => 'lms_id', |
33 | 33 | 'label' => 'LMS code', |
34 | - 'type' => 'text', ], ); |
|
34 | + 'type' => 'text', ],); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | protected function setupCreateOperation() |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | 'type' => 'text', ]); |
43 | 43 | CRUD::addField(['name' => 'lms_id', |
44 | 44 | 'label' => 'LMS code', |
45 | - 'type' => 'text', ], ); |
|
45 | + 'type' => 'text', ],); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | protected function setupUpdateOperation() |
@@ -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', |