@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | 'client_idnumber' => 'required', |
| 31 | 31 | 'client_address' => 'required', |
| 32 | 32 | 'client_email' => 'required', |
| 33 | - 'payments' => function ($attribute, $value, $fail) { |
|
| 33 | + 'payments' => function($attribute, $value, $fail) { |
|
| 34 | 34 | $fieldGroups = json_decode($value); |
| 35 | 35 | |
| 36 | 36 | // allow repeatable field to be empty |
@@ -42,14 +42,14 @@ discard block |
||
| 42 | 42 | // run through each field group inside the repeatable field |
| 43 | 43 | // and run a custom validation for it |
| 44 | 44 | foreach ($fieldGroups as $key => $group) { |
| 45 | - $fieldGroupValidator = Validator::make((array)$group, ['payment_method' => 'required|string', 'date' => 'required|date', 'value' => 'numeric|required', 'comment' => 'string|nullable', 'responsable_id' => 'nullable',]); |
|
| 45 | + $fieldGroupValidator = Validator::make((array) $group, ['payment_method' => 'required|string', 'date' => 'required|date', 'value' => 'numeric|required', 'comment' => 'string|nullable', 'responsable_id' => 'nullable', ]); |
|
| 46 | 46 | |
| 47 | 47 | if ($fieldGroupValidator->fails()) { |
| 48 | 48 | return $fail($fieldGroupValidator->errors()->first()); |
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | }, |
| 52 | - 'invoiceDetails' => function ($attribute, $value, $fail) { |
|
| 52 | + 'invoiceDetails' => function($attribute, $value, $fail) { |
|
| 53 | 53 | $fieldGroups = json_decode($value); |
| 54 | 54 | |
| 55 | 55 | // allow repeatable field to be empty |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | // run through each field group inside the repeatable field |
| 62 | 62 | // and run a custom validation for it |
| 63 | 63 | foreach ($fieldGroups as $key => $group) { |
| 64 | - $fieldGroupValidator = Validator::make((array)$group, ['product_name' => 'required|string', 'price' => 'numeric|required', 'quantity' => 'numeric|required']); |
|
| 64 | + $fieldGroupValidator = Validator::make((array) $group, ['product_name' => 'required|string', 'price' => 'numeric|required', 'quantity' => 'numeric|required']); |
|
| 65 | 65 | |
| 66 | 66 | if ($fieldGroupValidator->fails()) { |
| 67 | 67 | return $fail($fieldGroupValidator->errors()->first()); |
@@ -96,14 +96,14 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | CRUD::addColumns([['name' => 'id', |
| 98 | 98 | 'label' => 'ID', |
| 99 | - 'wrapper' => ['element' => function ($crud, $column, $entry) { |
|
| 99 | + 'wrapper' => ['element' => function($crud, $column, $entry) { |
|
| 100 | 100 | return $entry->status_id > 2 ? 'del' : 'span'; |
| 101 | 101 | }], ], |
| 102 | 102 | |
| 103 | 103 | ['label' => __('ID number'), |
| 104 | 104 | 'type' => 'text', |
| 105 | 105 | 'name' => 'student.idnumber', |
| 106 | - 'wrapper' => ['element' => function ($crud, $column, $entry) { |
|
| 106 | + 'wrapper' => ['element' => function($crud, $column, $entry) { |
|
| 107 | 107 | return $entry->status_id > 2 ? 'del' : 'span'; |
| 108 | 108 | }], ], |
| 109 | 109 | |
@@ -112,17 +112,17 @@ discard block |
||
| 112 | 112 | 'attribute' => 'lastname', |
| 113 | 113 | 'label' => __('Last Name'), |
| 114 | 114 | 'type' => 'relationship', |
| 115 | - 'wrapper' => ['element' => function ($crud, $column, $entry) { |
|
| 115 | + 'wrapper' => ['element' => function($crud, $column, $entry) { |
|
| 116 | 116 | return $entry->status_id > 2 ? 'del' : 'span'; |
| 117 | 117 | }], |
| 118 | 118 | 'orderable' => true, |
| 119 | - 'orderLogic' => function ($query, $column, $columnDirection) { |
|
| 119 | + 'orderLogic' => function($query, $column, $columnDirection) { |
|
| 120 | 120 | return $query->leftJoin('users', 'enrollments.student_id', '=', 'users.id') |
| 121 | 121 | ->orderBy('users.lastname', $columnDirection)->select('enrollments.*'); |
| 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 | }); |
@@ -134,17 +134,17 @@ discard block |
||
| 134 | 134 | 'attribute' => 'firstname', |
| 135 | 135 | 'label' => __('First Name'), |
| 136 | 136 | 'type' => 'relationship', |
| 137 | - 'wrapper' => ['element' => function ($crud, $column, $entry) { |
|
| 137 | + 'wrapper' => ['element' => function($crud, $column, $entry) { |
|
| 138 | 138 | return $entry->status_id > 2 ? 'del' : 'span'; |
| 139 | 139 | }], |
| 140 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 141 | - $query->orWhereHas('student', function ($q) use ($searchTerm) { |
|
| 142 | - $q->whereHas('user', function ($q) use ($searchTerm) { |
|
| 140 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 141 | + $query->orWhereHas('student', function($q) use ($searchTerm) { |
|
| 142 | + $q->whereHas('user', function($q) use ($searchTerm) { |
|
| 143 | 143 | $q->where('firstname', 'like', '%'.$searchTerm.'%'); |
| 144 | 144 | }); |
| 145 | 145 | }); |
| 146 | 146 | }, |
| 147 | - 'orderLogic' => function ($query, $column, $columnDirection) { |
|
| 147 | + 'orderLogic' => function($query, $column, $columnDirection) { |
|
| 148 | 148 | return $query->leftJoin('users', 'enrollments.student_id', '=', 'users.id') |
| 149 | 149 | ->orderBy('users.firstname', $columnDirection)->select('enrollments.*'); |
| 150 | 150 | }, |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | 'name' => 'course.period', |
| 169 | 169 | 'label' => __('Period'), |
| 170 | 170 | 'attribute' => 'name', |
| 171 | - 'orderLogic' => function ($query, $column, $columnDirection) { |
|
| 171 | + 'orderLogic' => function($query, $column, $columnDirection) { |
|
| 172 | 172 | return $query->leftJoin('courses', 'enrollments.course_id', '=', 'courses.id') |
| 173 | 173 | ->orderBy('courses.period_id', $columnDirection)->select('enrollments.*'); |
| 174 | 174 | }, |
@@ -183,9 +183,9 @@ discard block |
||
| 183 | 183 | 'attribute' => 'name', |
| 184 | 184 | 'model' => EnrollmentStatusType::class, |
| 185 | 185 | 'wrapper' => ['element' => 'span', |
| 186 | - 'class' => function ($crud, $column, $entry) { |
|
| 186 | + 'class' => function($crud, $column, $entry) { |
|
| 187 | 187 | return 'badge badge-pill badge-'.$entry->enrollmentStatus->styling(); |
| 188 | - }, ], ]]); |
|
| 188 | + },], ]]); |
|
| 189 | 189 | |
| 190 | 190 | if (config('app.books_module') && $this->mode === 'course') { |
| 191 | 191 | CRUD::addColumn(['name' => 'hasBook', |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | if ($this->mode === 'global') { |
| 240 | 240 | CRUD::addFilter(['name' => 'status_id', |
| 241 | 241 | 'type' => 'select2_multiple', |
| 242 | - 'label' => __('Status'), ], fn () => EnrollmentStatusType::all()->pluck('name', 'id')->toArray(), function ($values) { |
|
| 242 | + 'label' => __('Status'), ], fn() => EnrollmentStatusType::all()->pluck('name', 'id')->toArray(), function($values) { |
|
| 243 | 243 | foreach (json_decode($values, null, 512, JSON_THROW_ON_ERROR) as $value) { |
| 244 | 244 | CRUD::addClause('orWhere', 'status_id', $value); |
| 245 | 245 | } |
@@ -247,17 +247,17 @@ discard block |
||
| 247 | 247 | |
| 248 | 248 | CRUD::addFilter(['name' => 'period_id', |
| 249 | 249 | 'type' => 'select2', |
| 250 | - 'label' => __('Period'), ], fn () => Period::all()->pluck('name', 'id')->toArray(), function ($value) { |
|
| 250 | + 'label' => __('Period'), ], fn() => Period::all()->pluck('name', 'id')->toArray(), function($value) { |
|
| 251 | 251 | CRUD::addClause('period', $value); |
| 252 | 252 | }); |
| 253 | 253 | |
| 254 | 254 | CRUD::addFilter(['name' => 'scholarship', |
| 255 | 255 | 'type' => 'select2', |
| 256 | - 'label' => __('Scholarship'), ], fn () => Scholarship::all()->pluck('name', 'id')->toArray(), function ($value) { |
|
| 256 | + 'label' => __('Scholarship'), ], fn() => Scholarship::all()->pluck('name', 'id')->toArray(), function($value) { |
|
| 257 | 257 | if ($value == 'all') { |
| 258 | 258 | CRUD::addClause('whereHas', 'scholarships'); |
| 259 | 259 | } else { |
| 260 | - CRUD::addClause('whereHas', 'scholarships', function ($q) use ($value) { |
|
| 260 | + CRUD::addClause('whereHas', 'scholarships', function($q) use ($value) { |
|
| 261 | 261 | $q->where('scholarships.id', $value); |
| 262 | 262 | }); |
| 263 | 263 | } |
@@ -278,8 +278,8 @@ discard block |
||
| 278 | 278 | // then load the page |
| 279 | 279 | $commentsIncludingInvoices = $enrollment->comments |
| 280 | 280 | ->concat($enrollment->invoices() |
| 281 | - ->map(fn($invoice) => $invoice->comments->map(function ($comment) use ($invoice) { |
|
| 282 | - $comment->prefix = '(' . __('Invoice') . " " . ($invoice->invoice_reference ?? $invoice->id) . ")"; |
|
| 281 | + ->map(fn($invoice) => $invoice->comments->map(function($comment) use ($invoice) { |
|
| 282 | + $comment->prefix = '('.__('Invoice')." ".($invoice->invoice_reference ?? $invoice->id).")"; |
|
| 283 | 283 | return $comment; |
| 284 | 284 | })) |
| 285 | 285 | ->flatten() |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | 'model' => Course::class, |
| 312 | 312 | 'attribute' => 'name', |
| 313 | 313 | |
| 314 | - 'options' => (fn ($query) => $query->orderBy('level_id', 'ASC')->where('period_id', $this->crud->getCurrentEntry()->course->period_id)->get()), |
|
| 314 | + 'options' => (fn($query) => $query->orderBy('level_id', 'ASC')->where('period_id', $this->crud->getCurrentEntry()->course->period_id)->get()), |
|
| 315 | 315 | ]); |
| 316 | 316 | |
| 317 | 317 | CRUD::addField(array_merge([ |