@@ -71,7 +71,7 @@ |
||
71 | 71 | |
72 | 72 | // persist the products |
73 | 73 | foreach ($request->products as $f => $product) { |
74 | - $productType = match ($product['type']) { |
|
74 | + $productType = match($product['type']) { |
|
75 | 75 | 'enrollment' => Enrollment::class, |
76 | 76 | 'scheduledPayment' => ScheduledPayment::class, |
77 | 77 | 'fee' => Fee::class, |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | 'price_b' => $enrollment->course->price_b, |
184 | 184 | 'price_c' => $enrollment->course->price_c, |
185 | 185 | ]), |
186 | - 'studentPriceCategory' => $enrollment->student?->price_category, |
|
186 | + 'studentPriceCategory' => $enrollment->student ? ->price_category, |
|
187 | 187 | ] |
188 | 188 | ); |
189 | 189 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | |
222 | 222 | public function getBalance(Request $request) |
223 | 223 | { |
224 | - if (! config('invoicing.invoices_contain_enrollments_only')) { |
|
224 | + if (!config('invoicing.invoices_contain_enrollments_only')) { |
|
225 | 225 | abort(422, 'Configuration options forbid to access this value'); |
226 | 226 | } |
227 | 227 |
@@ -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 | ); |
@@ -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 |
@@ -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', |
@@ -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', |
@@ -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 | } |