@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | 'name' => 'id', |
| 93 | 93 | 'label' => 'ID', |
| 94 | 94 | 'wrapper' => [ |
| 95 | - 'element' => function ($crud, $column, $entry) { |
|
| 95 | + 'element' => function($crud, $column, $entry) { |
|
| 96 | 96 | return $entry->status_id > 2 ? 'del' : 'span'; |
| 97 | 97 | }, |
| 98 | 98 | ], |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | 'type' => 'text', |
| 104 | 104 | 'name' => 'student.idnumber', |
| 105 | 105 | 'wrapper' => [ |
| 106 | - 'element' => function ($crud, $column, $entry) { |
|
| 106 | + 'element' => function($crud, $column, $entry) { |
|
| 107 | 107 | return $entry->status_id > 2 ? 'del' : 'span'; |
| 108 | 108 | }, |
| 109 | 109 | ], |
@@ -116,13 +116,13 @@ discard block |
||
| 116 | 116 | 'label' => __('Last Name'), |
| 117 | 117 | 'type' => 'relationship', |
| 118 | 118 | 'wrapper' => [ |
| 119 | - 'element' => function ($crud, $column, $entry) { |
|
| 119 | + 'element' => function($crud, $column, $entry) { |
|
| 120 | 120 | return $entry->status_id > 2 ? 'del' : 'span'; |
| 121 | 121 | }, |
| 122 | 122 | ], |
| 123 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 124 | - $query->orWhereHas('student', function ($q) use ($searchTerm) { |
|
| 125 | - $q->whereHas('user', function ($q) use ($searchTerm) { |
|
| 123 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 124 | + $query->orWhereHas('student', function($q) use ($searchTerm) { |
|
| 125 | + $q->whereHas('user', function($q) use ($searchTerm) { |
|
| 126 | 126 | $q->where('lastname', 'like', '%'.$searchTerm.'%'); |
| 127 | 127 | }); |
| 128 | 128 | }); |
@@ -136,13 +136,13 @@ discard block |
||
| 136 | 136 | 'label' => __('First Name'), |
| 137 | 137 | 'type' => 'relationship', |
| 138 | 138 | 'wrapper' => [ |
| 139 | - 'element' => function ($crud, $column, $entry) { |
|
| 139 | + 'element' => function($crud, $column, $entry) { |
|
| 140 | 140 | return $entry->status_id > 2 ? 'del' : 'span'; |
| 141 | 141 | }, |
| 142 | 142 | ], |
| 143 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 144 | - $query->orWhereHas('student', function ($q) use ($searchTerm) { |
|
| 145 | - $q->whereHas('user', function ($q) use ($searchTerm) { |
|
| 143 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 144 | + $query->orWhereHas('student', function($q) use ($searchTerm) { |
|
| 145 | + $q->whereHas('user', function($q) use ($searchTerm) { |
|
| 146 | 146 | $q->where('firstname', 'like', '%'.$searchTerm.'%'); |
| 147 | 147 | }); |
| 148 | 148 | }); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | 'model' => EnrollmentStatusType::class, |
| 189 | 189 | 'wrapper' => [ |
| 190 | 190 | 'element' => 'span', |
| 191 | - 'class' => function ($crud, $column, $entry) { |
|
| 191 | + 'class' => function($crud, $column, $entry) { |
|
| 192 | 192 | return 'badge badge-pill badge-'.$entry->enrollmentStatus->styling(); |
| 193 | 193 | }, |
| 194 | 194 | ], |
@@ -236,8 +236,8 @@ discard block |
||
| 236 | 236 | 'type' => 'select2_multiple', |
| 237 | 237 | 'label'=> __('Status'), |
| 238 | 238 | ], |
| 239 | - fn () => EnrollmentStatusType::all()->pluck('name', 'id')->toArray(), |
|
| 240 | - function ($values) { |
|
| 239 | + fn() => EnrollmentStatusType::all()->pluck('name', 'id')->toArray(), |
|
| 240 | + function($values) { |
|
| 241 | 241 | foreach (json_decode($values, null, 512, JSON_THROW_ON_ERROR) as $value) { |
| 242 | 242 | CRUD::addClause('orWhere', 'status_id', $value); |
| 243 | 243 | } |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | 'name' => 'period_id', |
| 249 | 249 | 'type' => 'select2', |
| 250 | 250 | 'label'=> __('Period'), |
| 251 | - ], fn () => Period::all()->pluck('name', 'id')->toArray(), function ($value) { |
|
| 251 | + ], fn() => Period::all()->pluck('name', 'id')->toArray(), function($value) { |
|
| 252 | 252 | CRUD::addClause('period', $value); |
| 253 | 253 | }); |
| 254 | 254 | |
@@ -258,12 +258,12 @@ discard block |
||
| 258 | 258 | 'type' => 'select2', |
| 259 | 259 | 'label'=> __('Scholarship'), |
| 260 | 260 | ], |
| 261 | - fn () => Scholarship::all()->pluck('name', 'id')->toArray(), |
|
| 262 | - function ($value) { // if the filter is active |
|
| 261 | + fn() => Scholarship::all()->pluck('name', 'id')->toArray(), |
|
| 262 | + function($value) { // if the filter is active |
|
| 263 | 263 | if ($value == 'all') { |
| 264 | 264 | CRUD::addClause('whereHas', 'scholarships'); |
| 265 | 265 | } else { |
| 266 | - CRUD::addClause('whereHas', 'scholarships', function ($q) use ($value) { |
|
| 266 | + CRUD::addClause('whereHas', 'scholarships', function($q) use ($value) { |
|
| 267 | 267 | $q->where('scholarships.id', $value); |
| 268 | 268 | }); |
| 269 | 269 | } |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | 'model' => \App\Models\Course::class, |
| 304 | 304 | 'attribute' => 'name', |
| 305 | 305 | |
| 306 | - 'options' => (fn ($query) => $query->orderBy('level_id', 'ASC')->where('period_id', $this->crud->getCurrentEntry()->course->period_id)->get()), |
|
| 306 | + 'options' => (fn($query) => $query->orderBy('level_id', 'ASC')->where('period_id', $this->crud->getCurrentEntry()->course->period_id)->get()), |
|
| 307 | 307 | ]); |
| 308 | 308 | |
| 309 | 309 | CRUD::addField(array_merge([ |
@@ -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 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | { |
| 115 | 115 | $invoice = Invoice::findOrFail($id)->load('payments'); |
| 116 | 116 | |
| 117 | - if (! backpack_user()->can('enrollments.edit')) { |
|
| 117 | + if (!backpack_user()->can('enrollments.edit')) { |
|
| 118 | 118 | abort(403); |
| 119 | 119 | } |
| 120 | 120 | |
@@ -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, |
@@ -60,11 +60,11 @@ discard block |
||
| 60 | 60 | public function scopeWithoutChildren($query) |
| 61 | 61 | { |
| 62 | 62 | return $query |
| 63 | - ->where(function ($query) { |
|
| 63 | + ->where(function($query) { |
|
| 64 | 64 | $query->whereDoesntHave('childrenEnrollments') |
| 65 | 65 | ->where('parent_id', null); |
| 66 | 66 | }) |
| 67 | - ->orWhere(function ($query) { |
|
| 67 | + ->orWhere(function($query) { |
|
| 68 | 68 | $query->where('parent_id', null); |
| 69 | 69 | }) |
| 70 | 70 | ->get(); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | public function scopePeriod(Builder $query, int $periodId) |
| 88 | 88 | { |
| 89 | - return $query->whereHas('course', function ($q) use ($periodId) { |
|
| 89 | + return $query->whereHas('course', function($q) use ($periodId) { |
|
| 90 | 90 | $q->where('period_id', $periodId); |
| 91 | 91 | }); |
| 92 | 92 | } |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | // also includes invoices for this enrollment's scheduled payments. |
| 181 | 181 | public function relatedInvoices() |
| 182 | 182 | { |
| 183 | - $scheduledPaymentsInvoices = $this->scheduledPayments->map(fn (ScheduledPayment $scheduledPayment) => $scheduledPayment->invoices()); |
|
| 183 | + $scheduledPaymentsInvoices = $this->scheduledPayments->map(fn(ScheduledPayment $scheduledPayment) => $scheduledPayment->invoices()); |
|
| 184 | 184 | |
| 185 | 185 | return $this->invoices()->concat($scheduledPaymentsInvoices)->flatten(1); |
| 186 | 186 | } |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | // if enabled, retrieve the default price category for the student |
| 335 | - if (config('invoicing.price_categories_enabled') && $this->student?->price_category) { |
|
| 335 | + if (config('invoicing.price_categories_enabled') && $this->student ? ->price_category) { |
|
| 336 | 336 | $price_category = $this->student->price_category; |
| 337 | 337 | |
| 338 | 338 | return $this->course->$price_category ?? 0; |
@@ -362,11 +362,11 @@ discard block |
||
| 362 | 362 | |
| 363 | 363 | // delete attendance records related to the enrollment |
| 364 | 364 | $attendances = $this->course->attendance->where('student_id', $this->student->id); |
| 365 | - Attendance::destroy($attendances->map(fn ($item, $key) => $item->id)); |
|
| 365 | + Attendance::destroy($attendances->map(fn($item, $key) => $item->id)); |
|
| 366 | 366 | |
| 367 | 367 | foreach ($this->course->children as $child) { |
| 368 | 368 | $attendances = $child->attendance->where('student_id', $this->student->id); |
| 369 | - Attendance::destroy($attendances->map(fn ($item, $key) => $item->id)); |
|
| 369 | + Attendance::destroy($attendances->map(fn($item, $key) => $item->id)); |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | $this->delete(); |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | // if one book is expired |
| 400 | - if ($this->student && $this->student->books->where('id', $book->id)->filter(fn ($book) => $book->pivot->expiry_date == null || $book->pivot->expiry_date > Carbon::now())->count() == 0) { |
|
| 400 | + if ($this->student && $this->student->books->where('id', $book->id)->filter(fn($book) => $book->pivot->expiry_date == null || $book->pivot->expiry_date > Carbon::now())->count() == 0) { |
|
| 401 | 401 | return 'EXP'; |
| 402 | 402 | } |
| 403 | 403 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | public function scopeStatus(Builder $query, $status) |
| 29 | 29 | { |
| 30 | - return match ($status) { |
|
| 30 | + return match($status) { |
|
| 31 | 31 | '2' => $query->where('status', 2), |
| 32 | 32 | '1' => $query->where('status', 1), |
| 33 | 33 | default => $query, |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | public function getStatusTypeNameAttribute() |
| 121 | 121 | { |
| 122 | - return match ($this->status) { |
|
| 122 | + return match($this->status) { |
|
| 123 | 123 | 2 => __('Paid'), |
| 124 | 124 | 1 => __('Pending'), |
| 125 | 125 | default => '-', |
@@ -39,6 +39,6 @@ |
||
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | - echo "\n".$fixedAnomaliesCount.' inconsistencies fixed and ' . $unsolvedMysteries . ' remaining.'; |
|
| 42 | + echo "\n".$fixedAnomaliesCount.' inconsistencies fixed and '.$unsolvedMysteries.' remaining.'; |
|
| 43 | 43 | } |
| 44 | 44 | } |
@@ -33,8 +33,7 @@ |
||
| 33 | 33 | } else { |
| 34 | 34 | $unsolvedMysteries++; |
| 35 | 35 | } |
| 36 | - } |
|
| 37 | - else { |
|
| 36 | + } else { |
|
| 38 | 37 | echo "\nproduct $product->product_id seems to be a valid enrollment"; |
| 39 | 38 | } |
| 40 | 39 | } |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | foreach (Invoice::all() as $invoice) { |
| 19 | 19 | if ($invoice->total_price !== $invoice->totalPrice()) { |
| 20 | 20 | $anomalies++; |
| 21 | - echo "\ninvoice ".$invoice->id. ' should be ' . $invoice->total_price . ' vs ' . $invoice->totalpricebyproducts() .' real '; |
|
| 21 | + echo "\ninvoice ".$invoice->id.' should be '.$invoice->total_price.' vs '.$invoice->totalpricebyproducts().' real '; |
|
| 22 | 22 | } |
| 23 | 23 | } |
| 24 | 24 | echo "\n".$anomalies.' anomalies detected'; |