@@ -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, |
@@ -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 => '-', |
@@ -46,10 +46,10 @@ discard block |
||
| 46 | 46 | 'attribute' => 'lastname', |
| 47 | 47 | 'model' => User::class, |
| 48 | 48 | 'orderable' => true, |
| 49 | - 'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
| 49 | + 'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
| 50 | 50 | ->orderBy('users.lastname', $columnDirection)->select('students.*'), |
| 51 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 52 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 51 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 52 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 53 | 53 | $q->where('lastname', 'like', '%'.$searchTerm.'%'); |
| 54 | 54 | }); |
| 55 | 55 | }, |
@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | 'attribute' => 'firstname', |
| 65 | 65 | 'model' => User::class, |
| 66 | 66 | 'orderable' => true, |
| 67 | - 'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'teachers.id') |
|
| 67 | + 'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'teachers.id') |
|
| 68 | 68 | ->orderBy('users.firstname', $columnDirection)->select('teachers.*'), |
| 69 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 70 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 69 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 70 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 71 | 71 | $q->where('firstname', 'like', '%'.$searchTerm.'%'); |
| 72 | 72 | }); |
| 73 | 73 | }, |
@@ -81,10 +81,10 @@ discard block |
||
| 81 | 81 | 'attribute' => 'email', |
| 82 | 82 | 'model' => User::class, |
| 83 | 83 | 'orderable' => true, |
| 84 | - 'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'teachers.id') |
|
| 84 | + 'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'teachers.id') |
|
| 85 | 85 | ->orderBy('users.email', $columnDirection)->select('teachers.*'), |
| 86 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 87 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 86 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 87 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 88 | 88 | $q->where('email', 'like', '%'.$searchTerm.'%'); |
| 89 | 89 | }); |
| 90 | 90 | }, |
@@ -181,8 +181,8 @@ discard block |
||
| 181 | 181 | $username_parts = array_filter(explode(' ', strtolower($fullName))); |
| 182 | 182 | $username_parts = array_slice($username_parts, -2); |
| 183 | 183 | |
| 184 | - $part1 = (! empty($username_parts[0])) ? substr($username_parts[0], 0, 3) : ''; |
|
| 185 | - $part2 = (! empty($username_parts[1])) ? substr($username_parts[1], 0, 8) : ''; |
|
| 184 | + $part1 = (!empty($username_parts[0])) ? substr($username_parts[0], 0, 3) : ''; |
|
| 185 | + $part2 = (!empty($username_parts[1])) ? substr($username_parts[1], 0, 8) : ''; |
|
| 186 | 186 | $part3 = random_int(999, 9999); |
| 187 | 187 | |
| 188 | 188 | $username = $part1.$part2.$part3; //str_shuffle to randomly shuffle all characters |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | protected function setupListOperation() |
| 32 | 32 | { |
| 33 | 33 | CRUD::setColumns([ |
| 34 | - [ // skill type |
|
| 34 | + [// skill type |
|
| 35 | 35 | 'label' => 'Type', |
| 36 | 36 | 'type' => 'select', |
| 37 | 37 | 'name' => 'skill_type', |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | 'type' => 'text', |
| 45 | 45 | 'name' => 'name', |
| 46 | 46 | ], |
| 47 | - [ // skill level |
|
| 47 | + [// skill level |
|
| 48 | 48 | 'label' => 'Level', |
| 49 | 49 | 'type' => 'select', |
| 50 | 50 | 'name' => 'level', |
@@ -56,19 +56,19 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | CRUD::enableExportButtons(); |
| 58 | 58 | |
| 59 | - CRUD::addFilter([ // select2 filter |
|
| 59 | + CRUD::addFilter([// select2 filter |
|
| 60 | 60 | 'name' => 'level_id', |
| 61 | 61 | 'type' => 'select2', |
| 62 | 62 | 'label'=> 'Level', |
| 63 | - ], fn () => Level::all()->pluck('name', 'id')->toArray(), function ($value) { // if the filter is active |
|
| 63 | + ], fn() => Level::all()->pluck('name', 'id')->toArray(), function($value) { // if the filter is active |
|
| 64 | 64 | CRUD::addClause('where', 'level_id', $value); |
| 65 | 65 | }); |
| 66 | 66 | |
| 67 | - CRUD::addFilter([ // select2 filter |
|
| 67 | + CRUD::addFilter([// select2 filter |
|
| 68 | 68 | 'name' => 'skill_type_id', |
| 69 | 69 | 'type' => 'select2', |
| 70 | 70 | 'label'=> 'Type', |
| 71 | - ], fn () => SkillType::all()->pluck('name', 'id')->toArray(), function ($value) { // if the filter is active |
|
| 71 | + ], fn() => SkillType::all()->pluck('name', 'id')->toArray(), function($value) { // if the filter is active |
|
| 72 | 72 | CRUD::addClause('where', 'skill_type_id', $value); |
| 73 | 73 | }); |
| 74 | 74 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | { |
| 78 | 78 | CRUD::setValidation(StoreRequest::class); |
| 79 | 79 | CRUD::addFields([ |
| 80 | - [ // skill type |
|
| 80 | + [// skill type |
|
| 81 | 81 | 'label' => 'Type', |
| 82 | 82 | 'type' => 'select', |
| 83 | 83 | 'name' => 'skill_type_id', |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | 'type' => 'text', |
| 91 | 91 | 'name' => 'name', |
| 92 | 92 | ], |
| 93 | - [ // skill level |
|
| 93 | + [// skill level |
|
| 94 | 94 | 'label' => 'Level', |
| 95 | 95 | 'type' => 'select', |
| 96 | 96 | 'name' => 'level_id', |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | 'type' => 'relationship', |
| 104 | 104 | 'name' => 'skill_type', // the method on your model that defines the relationship |
| 105 | 105 | 'ajax' => true, |
| 106 | - 'inline_create' => [ // specify the entity in singular |
|
| 106 | + 'inline_create' => [// specify the entity in singular |
|
| 107 | 107 | 'entity' => 'skilltype', // the entity in singular |
| 108 | 108 | // OPTIONALS |
| 109 | 109 | 'force_select' => true, // should the inline-created entry be immediately selected? |
@@ -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 | |
@@ -228,8 +228,7 @@ |
||
| 228 | 228 | $periodId = $request->get('periodId'); |
| 229 | 229 | if ($periodId) { |
| 230 | 230 | $pendingBalance = Enrollment::period($periodId)->pending()->sum('balance'); |
| 231 | - } |
|
| 232 | - else { |
|
| 231 | + } else { |
|
| 233 | 232 | $pendingBalance = Enrollment::pending()->sum('balance'); |
| 234 | 233 | } |
| 235 | 234 | |
@@ -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 | } |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | |
| 409 | 409 | public function getBalanceAttribute() |
| 410 | 410 | { |
| 411 | - if (! config('invoicing.invoices_contain_enrollments_only')) { |
|
| 411 | + if (!config('invoicing.invoices_contain_enrollments_only')) { |
|
| 412 | 412 | abort(422, 'Configuration options forbid to access this value'); |
| 413 | 413 | } |
| 414 | 414 | |
@@ -93,103 +93,103 @@ discard block |
||
| 93 | 93 | $currency = ['suffix' => config('app.currency_symbol')]; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - CRUD::addColumns([['name' => 'id', 'label' => 'ID', 'wrapper' => ['element' => function ($crud, $column, $entry) { |
|
| 96 | + CRUD::addColumns([['name' => 'id', 'label' => 'ID', 'wrapper' => ['element' => function($crud, $column, $entry) { |
|
| 97 | 97 | return $entry->status_id > 2 ? 'del' : 'span'; |
| 98 | - },],], |
|
| 98 | + },], ], |
|
| 99 | 99 | |
| 100 | - ['label' => __('ID number'), 'type' => 'text', 'name' => 'student.idnumber', 'wrapper' => ['element' => function ($crud, $column, $entry) { |
|
| 100 | + ['label' => __('ID number'), 'type' => 'text', 'name' => 'student.idnumber', 'wrapper' => ['element' => function($crud, $column, $entry) { |
|
| 101 | 101 | return $entry->status_id > 2 ? 'del' : 'span'; |
| 102 | - },],], |
|
| 102 | + },], ], |
|
| 103 | 103 | |
| 104 | - ['name' => 'user', 'key' => 'user_lastname', 'attribute' => 'lastname', 'label' => __('Last Name'), 'type' => 'relationship', 'wrapper' => ['element' => function ($crud, $column, $entry) { |
|
| 104 | + ['name' => 'user', 'key' => 'user_lastname', 'attribute' => 'lastname', 'label' => __('Last Name'), 'type' => 'relationship', 'wrapper' => ['element' => function($crud, $column, $entry) { |
|
| 105 | 105 | return $entry->status_id > 2 ? 'del' : 'span'; |
| 106 | 106 | },], |
| 107 | 107 | 'orderable' => true, |
| 108 | - 'orderLogic' => function ($query, $column, $columnDirection) { |
|
| 108 | + 'orderLogic' => function($query, $column, $columnDirection) { |
|
| 109 | 109 | return $query->leftJoin('users', 'enrollments.student_id', '=', 'users.id') |
| 110 | 110 | ->orderBy('users.lastname', $columnDirection)->select('enrollments.*'); |
| 111 | 111 | }, |
| 112 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 113 | - $query->orWhereHas('student', function ($q) use ($searchTerm) { |
|
| 114 | - $q->whereHas('user', function ($q) use ($searchTerm) { |
|
| 115 | - $q->where('lastname', 'like', '%' . $searchTerm . '%'); |
|
| 112 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 113 | + $query->orWhereHas('student', function($q) use ($searchTerm) { |
|
| 114 | + $q->whereHas('user', function($q) use ($searchTerm) { |
|
| 115 | + $q->where('lastname', 'like', '%'.$searchTerm.'%'); |
|
| 116 | 116 | }); |
| 117 | 117 | }); |
| 118 | 118 | },], |
| 119 | 119 | |
| 120 | - ['name' => 'user', 'key' => 'user_firstname', 'attribute' => 'firstname', 'label' => __('First Name'), 'type' => 'relationship', 'wrapper' => ['element' => function ($crud, $column, $entry) { |
|
| 120 | + ['name' => 'user', 'key' => 'user_firstname', 'attribute' => 'firstname', 'label' => __('First Name'), 'type' => 'relationship', 'wrapper' => ['element' => function($crud, $column, $entry) { |
|
| 121 | 121 | return $entry->status_id > 2 ? 'del' : 'span'; |
| 122 | 122 | },], |
| 123 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 124 | - $query->orWhereHas('student', function ($q) use ($searchTerm) { |
|
| 125 | - $q->whereHas('user', function ($q) use ($searchTerm) { |
|
| 126 | - $q->where('firstname', 'like', '%' . $searchTerm . '%'); |
|
| 123 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 124 | + $query->orWhereHas('student', function($q) use ($searchTerm) { |
|
| 125 | + $q->whereHas('user', function($q) use ($searchTerm) { |
|
| 126 | + $q->where('firstname', 'like', '%'.$searchTerm.'%'); |
|
| 127 | 127 | }); |
| 128 | 128 | }); |
| 129 | 129 | }, |
| 130 | - 'orderLogic' => function ($query, $column, $columnDirection) { |
|
| 130 | + 'orderLogic' => function($query, $column, $columnDirection) { |
|
| 131 | 131 | return $query->leftJoin('users', 'enrollments.student_id', '=', 'users.id') |
| 132 | 132 | ->orderBy('users.firstname', $columnDirection)->select('enrollments.*'); |
| 133 | 133 | }, |
| 134 | 134 | 'orderable' => true, |
| 135 | 135 | ], |
| 136 | 136 | |
| 137 | - ['label' => __('Age'), 'name' => 'student_age',], |
|
| 137 | + ['label' => __('Age'), 'name' => 'student_age', ], |
|
| 138 | 138 | |
| 139 | - ['label' => __('Birthdate'), 'name' => 'student_birthdate',],]); |
|
| 139 | + ['label' => __('Birthdate'), 'name' => 'student_birthdate', ], ]); |
|
| 140 | 140 | |
| 141 | 141 | if ($this->mode === 'global') { |
| 142 | - CRUD::addColumns([['label' => __('Course'), 'type' => 'select', 'name' => 'course_id', 'entity' => 'course', 'attribute' => 'name', 'model' => Course::class,], |
|
| 142 | + CRUD::addColumns([['label' => __('Course'), 'type' => 'select', 'name' => 'course_id', 'entity' => 'course', 'attribute' => 'name', 'model' => Course::class, ], |
|
| 143 | 143 | ['type' => 'relationship', 'name' => 'course.period', 'label' => __('Period'), 'attribute' => 'name', |
| 144 | - 'orderLogic' => function ($query, $column, $columnDirection) { |
|
| 144 | + 'orderLogic' => function($query, $column, $columnDirection) { |
|
| 145 | 145 | return $query->leftJoin('courses', 'enrollments.course_id', '=', 'courses.id') |
| 146 | 146 | ->orderBy('courses.period_id', $columnDirection)->select('enrollments.*'); |
| 147 | 147 | }, |
| 148 | 148 | 'orderable' => true, |
| 149 | - ],]); |
|
| 149 | + ], ]); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - CRUD::addColumns([['label' => __('Status'), 'type' => 'select', 'name' => 'status_id', 'entity' => 'enrollmentStatus', 'attribute' => 'name', 'model' => EnrollmentStatusType::class, 'wrapper' => ['element' => 'span', 'class' => function ($crud, $column, $entry) { |
|
| 153 | - return 'badge badge-pill badge-' . $entry->enrollmentStatus->styling(); |
|
| 154 | - },],],]); |
|
| 152 | + CRUD::addColumns([['label' => __('Status'), 'type' => 'select', 'name' => 'status_id', 'entity' => 'enrollmentStatus', 'attribute' => 'name', 'model' => EnrollmentStatusType::class, 'wrapper' => ['element' => 'span', 'class' => function($crud, $column, $entry) { |
|
| 153 | + return 'badge badge-pill badge-'.$entry->enrollmentStatus->styling(); |
|
| 154 | + },], ], ]); |
|
| 155 | 155 | |
| 156 | 156 | if (config('invoicing.allow_scheduled_payments')) { |
| 157 | 157 | CRUD::addColumn(['name' => 'scheduledPayments', 'type' => 'relationship', 'label' => __('Scheduled Payments'), // OPTIONAL |
| 158 | - 'attribute' => 'date', 'model' => ScheduledPayment::class,]); |
|
| 158 | + 'attribute' => 'date', 'model' => ScheduledPayment::class, ]); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | CRUD::addColumn(array_merge(['name' => 'price', // The db column name |
| 162 | - 'label' => __('Price'), 'type' => 'number',], $currency)); |
|
| 162 | + 'label' => __('Price'), 'type' => 'number', ], $currency)); |
|
| 163 | 163 | |
| 164 | 164 | |
| 165 | 165 | if (config('invoicing.invoices_contain_enrollments_only')) { |
| 166 | - CRUD::addColumn(array_merge(['name' => 'balance', 'label' => __('Balance'), 'type' => 'number',], $currency)); |
|
| 166 | + CRUD::addColumn(array_merge(['name' => 'balance', 'label' => __('Balance'), 'type' => 'number', ], $currency)); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | CRUD::addColumns([ |
| 170 | 170 | |
| 171 | - ['name' => 'scholarships', 'type' => 'relationship', 'label' => __('Scholarship'), 'attribute' => 'name', 'model' => Scholarship::class,], |
|
| 171 | + ['name' => 'scholarships', 'type' => 'relationship', 'label' => __('Scholarship'), 'attribute' => 'name', 'model' => Scholarship::class, ], |
|
| 172 | 172 | |
| 173 | - ['label' => __('Email'), 'name' => 'user', 'attribute' => 'email', 'type' => 'relationship',], |
|
| 173 | + ['label' => __('Email'), 'name' => 'user', 'attribute' => 'email', 'type' => 'relationship', ], |
|
| 174 | 174 | |
| 175 | - ['label' => __('Phone Number'), 'type' => 'select_multiple', 'name' => 'student.phone', 'attribute' => 'phone_number', 'model' => PhoneNumber::class,],]); |
|
| 175 | + ['label' => __('Phone Number'), 'type' => 'select_multiple', 'name' => 'student.phone', 'attribute' => 'phone_number', 'model' => PhoneNumber::class, ], ]); |
|
| 176 | 176 | |
| 177 | 177 | if ($this->mode === 'global') { |
| 178 | - CRUD::addFilter(['name' => 'status_id', 'type' => 'select2_multiple', 'label' => __('Status'),], fn() => EnrollmentStatusType::all()->pluck('name', 'id')->toArray(), function ($values) { |
|
| 178 | + CRUD::addFilter(['name' => 'status_id', 'type' => 'select2_multiple', 'label' => __('Status'), ], fn() => EnrollmentStatusType::all()->pluck('name', 'id')->toArray(), function($values) { |
|
| 179 | 179 | foreach (json_decode($values, null, 512, JSON_THROW_ON_ERROR) as $value) { |
| 180 | 180 | CRUD::addClause('orWhere', 'status_id', $value); |
| 181 | 181 | } |
| 182 | 182 | }); |
| 183 | 183 | |
| 184 | - CRUD::addFilter(['name' => 'period_id', 'type' => 'select2', 'label' => __('Period'),], fn() => Period::all()->pluck('name', 'id')->toArray(), function ($value) { |
|
| 184 | + CRUD::addFilter(['name' => 'period_id', 'type' => 'select2', 'label' => __('Period'), ], fn() => Period::all()->pluck('name', 'id')->toArray(), function($value) { |
|
| 185 | 185 | CRUD::addClause('period', $value); |
| 186 | 186 | }); |
| 187 | 187 | |
| 188 | - CRUD::addFilter(['name' => 'scholarship', 'type' => 'select2', 'label' => __('Scholarship'),], fn() => Scholarship::all()->pluck('name', 'id')->toArray(), function ($value) { // if the filter is active |
|
| 188 | + CRUD::addFilter(['name' => 'scholarship', 'type' => 'select2', 'label' => __('Scholarship'), ], fn() => Scholarship::all()->pluck('name', 'id')->toArray(), function($value) { // if the filter is active |
|
| 189 | 189 | if ($value == 'all') { |
| 190 | 190 | CRUD::addClause('whereHas', 'scholarships'); |
| 191 | 191 | } else { |
| 192 | - CRUD::addClause('whereHas', 'scholarships', function ($q) use ($value) { |
|
| 192 | + CRUD::addClause('whereHas', 'scholarships', function($q) use ($value) { |
|
| 193 | 193 | $q->where('scholarships.id', $value); |
| 194 | 194 | }); |
| 195 | 195 | } |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | 'model' => Course::class, |
| 235 | 235 | 'attribute' => 'name', |
| 236 | 236 | |
| 237 | - 'options' => (fn ($query) => $query->orderBy('level_id', 'ASC')->where('period_id', $this->crud->getCurrentEntry()->course->period_id)->get()), |
|
| 237 | + 'options' => (fn($query) => $query->orderBy('level_id', 'ASC')->where('period_id', $this->crud->getCurrentEntry()->course->period_id)->get()), |
|
| 238 | 238 | ]); |
| 239 | 239 | |
| 240 | 240 | 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 | } |
@@ -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', // TODO fix this, an invoice can theoretically contain several enrollments |
| 160 | 160 | ]); |
| 161 | 161 | } |