@@ -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; |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | 'attribute' => 'lastname', |
118 | 118 | 'label' => __('Last Name'), |
119 | 119 | 'type' => 'relationship', |
120 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
121 | - $query->orWhereHas('student', function ($q) use ($searchTerm) { |
|
122 | - $q->whereHas('user', function ($q) use ($searchTerm) { |
|
120 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
121 | + $query->orWhereHas('student', function($q) use ($searchTerm) { |
|
122 | + $q->whereHas('user', function($q) use ($searchTerm) { |
|
123 | 123 | $q->where('lastname', 'like', '%'.$searchTerm.'%'); |
124 | 124 | }); |
125 | 125 | }); |
@@ -132,9 +132,9 @@ discard block |
||
132 | 132 | 'attribute' => 'firstname', |
133 | 133 | 'label' => __('First Name'), |
134 | 134 | 'type' => 'relationship', |
135 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
136 | - $query->orWhereHas('student', function ($q) use ($searchTerm) { |
|
137 | - $q->whereHas('user', function ($q) use ($searchTerm) { |
|
135 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
136 | + $query->orWhereHas('student', function($q) use ($searchTerm) { |
|
137 | + $q->whereHas('user', function($q) use ($searchTerm) { |
|
138 | 138 | $q->where('firstname', 'like', '%'.$searchTerm.'%'); |
139 | 139 | }); |
140 | 140 | }); |
@@ -226,8 +226,8 @@ discard block |
||
226 | 226 | 'name' => 'status_id', |
227 | 227 | 'type' => 'select2_multiple', |
228 | 228 | 'label'=> __('Status'), |
229 | - ], fn () => EnrollmentStatusType::all()->pluck('name', 'id')->toArray(), |
|
230 | - function ($values) { |
|
229 | + ], fn() => EnrollmentStatusType::all()->pluck('name', 'id')->toArray(), |
|
230 | + function($values) { |
|
231 | 231 | // if the filter is active |
232 | 232 | foreach (json_decode($values, null, 512, JSON_THROW_ON_ERROR) as $value) { |
233 | 233 | CRUD::addClause('orWhere', 'status_id', $value); |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | 'name' => 'period_id', |
239 | 239 | 'type' => 'select2', |
240 | 240 | 'label'=> __('Period'), |
241 | - ], fn () => Period::all()->pluck('name', 'id')->toArray(), function ($value) { |
|
241 | + ], fn() => Period::all()->pluck('name', 'id')->toArray(), function($value) { |
|
242 | 242 | // if the filter is active |
243 | 243 | CRUD::addClause('period', $value); |
244 | 244 | }); |
@@ -249,12 +249,12 @@ discard block |
||
249 | 249 | 'type' => 'select2', |
250 | 250 | 'label'=> __('Scholarship'), |
251 | 251 | ], |
252 | - fn () => Scholarship::all()->pluck('name', 'id')->toArray(), |
|
253 | - function ($value) { // if the filter is active |
|
252 | + fn() => Scholarship::all()->pluck('name', 'id')->toArray(), |
|
253 | + function($value) { // if the filter is active |
|
254 | 254 | if ($value == 'all') { |
255 | 255 | CRUD::addClause('whereHas', 'scholarships'); |
256 | 256 | } else { |
257 | - CRUD::addClause('whereHas', 'scholarships', function ($q) use ($value) { |
|
257 | + CRUD::addClause('whereHas', 'scholarships', function($q) use ($value) { |
|
258 | 258 | $q->where('scholarships.id', $value); |
259 | 259 | }); |
260 | 260 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | 'model' => \App\Models\Course::class, // foreign key model |
306 | 306 | 'attribute' => 'name', // foreign key attribute that is shown to user |
307 | 307 | |
308 | - 'options' => (fn ($query) => $query->orderBy('level_id', 'ASC')->where('period_id', $this->crud->getCurrentEntry()->course->period_id)->get()), |
|
308 | + 'options' => (fn($query) => $query->orderBy('level_id', 'ASC')->where('period_id', $this->crud->getCurrentEntry()->course->period_id)->get()), |
|
309 | 309 | ]); |
310 | 310 | |
311 | 311 | CRUD::addField(array_merge([ |
@@ -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', |