@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | 'name' => 'id', |
99 | 99 | 'label' => 'ID', |
100 | 100 | 'wrapper' => [ |
101 | - 'element' => function ($crud, $column, $entry) { |
|
101 | + 'element' => function($crud, $column, $entry) { |
|
102 | 102 | return $entry->status_id > 2 ? 'del' : 'span'; |
103 | 103 | }, |
104 | 104 | ], |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | 'type' => 'text', |
110 | 110 | 'name' => 'student.idnumber', |
111 | 111 | 'wrapper' => [ |
112 | - 'element' => function ($crud, $column, $entry) { |
|
112 | + 'element' => function($crud, $column, $entry) { |
|
113 | 113 | return $entry->status_id > 2 ? 'del' : 'span'; |
114 | 114 | }, |
115 | 115 | ], |
@@ -122,13 +122,13 @@ discard block |
||
122 | 122 | 'label' => __('Last Name'), |
123 | 123 | 'type' => 'relationship', |
124 | 124 | 'wrapper' => [ |
125 | - 'element' => function ($crud, $column, $entry) { |
|
125 | + 'element' => function($crud, $column, $entry) { |
|
126 | 126 | return $entry->status_id > 2 ? 'del' : 'span'; |
127 | 127 | }, |
128 | 128 | ], |
129 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
130 | - $query->orWhereHas('student', function ($q) use ($searchTerm) { |
|
131 | - $q->whereHas('user', function ($q) use ($searchTerm) { |
|
129 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
130 | + $query->orWhereHas('student', function($q) use ($searchTerm) { |
|
131 | + $q->whereHas('user', function($q) use ($searchTerm) { |
|
132 | 132 | $q->where('lastname', 'like', '%'.$searchTerm.'%'); |
133 | 133 | }); |
134 | 134 | }); |
@@ -142,13 +142,13 @@ discard block |
||
142 | 142 | 'label' => __('First Name'), |
143 | 143 | 'type' => 'relationship', |
144 | 144 | 'wrapper' => [ |
145 | - 'element' => function ($crud, $column, $entry) { |
|
145 | + 'element' => function($crud, $column, $entry) { |
|
146 | 146 | return $entry->status_id > 2 ? 'del' : 'span'; |
147 | 147 | }, |
148 | 148 | ], |
149 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
150 | - $query->orWhereHas('student', function ($q) use ($searchTerm) { |
|
151 | - $q->whereHas('user', function ($q) use ($searchTerm) { |
|
149 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
150 | + $query->orWhereHas('student', function($q) use ($searchTerm) { |
|
151 | + $q->whereHas('user', function($q) use ($searchTerm) { |
|
152 | 152 | $q->where('firstname', 'like', '%'.$searchTerm.'%'); |
153 | 153 | }); |
154 | 154 | }); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | 'model' => EnrollmentStatusType::class, |
195 | 195 | 'wrapper' => [ |
196 | 196 | 'element' => 'span', |
197 | - 'class' => function ($crud, $column, $entry) { |
|
197 | + 'class' => function($crud, $column, $entry) { |
|
198 | 198 | return 'badge badge-pill badge-'.$entry->enrollmentStatus->styling(); |
199 | 199 | }, |
200 | 200 | ], |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | |
218 | 218 | |
219 | 219 | if (config('invoicing.invoices_contain_enrollments_only')) { |
220 | - CRUD::addColumn(array_merge(['name' => 'balance', 'label' => __('Balance'), 'type' => 'number',], $currency)); |
|
220 | + CRUD::addColumn(array_merge(['name' => 'balance', 'label' => __('Balance'), 'type' => 'number', ], $currency)); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | CRUD::addColumns([ |
@@ -253,8 +253,8 @@ discard block |
||
253 | 253 | 'type' => 'select2_multiple', |
254 | 254 | 'label'=> __('Status'), |
255 | 255 | ], |
256 | - fn () => EnrollmentStatusType::all()->pluck('name', 'id')->toArray(), |
|
257 | - function ($values) { |
|
256 | + fn() => EnrollmentStatusType::all()->pluck('name', 'id')->toArray(), |
|
257 | + function($values) { |
|
258 | 258 | foreach (json_decode($values, null, 512, JSON_THROW_ON_ERROR) as $value) { |
259 | 259 | CRUD::addClause('orWhere', 'status_id', $value); |
260 | 260 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | 'name' => 'period_id', |
266 | 266 | 'type' => 'select2', |
267 | 267 | 'label'=> __('Period'), |
268 | - ], fn () => Period::all()->pluck('name', 'id')->toArray(), function ($value) { |
|
268 | + ], fn() => Period::all()->pluck('name', 'id')->toArray(), function($value) { |
|
269 | 269 | CRUD::addClause('period', $value); |
270 | 270 | }); |
271 | 271 | |
@@ -275,12 +275,12 @@ discard block |
||
275 | 275 | 'type' => 'select2', |
276 | 276 | 'label'=> __('Scholarship'), |
277 | 277 | ], |
278 | - fn () => Scholarship::all()->pluck('name', 'id')->toArray(), |
|
279 | - function ($value) { // if the filter is active |
|
278 | + fn() => Scholarship::all()->pluck('name', 'id')->toArray(), |
|
279 | + function($value) { // if the filter is active |
|
280 | 280 | if ($value == 'all') { |
281 | 281 | CRUD::addClause('whereHas', 'scholarships'); |
282 | 282 | } else { |
283 | - CRUD::addClause('whereHas', 'scholarships', function ($q) use ($value) { |
|
283 | + CRUD::addClause('whereHas', 'scholarships', function($q) use ($value) { |
|
284 | 284 | $q->where('scholarships.id', $value); |
285 | 285 | }); |
286 | 286 | } |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | 'model' => Course::class, |
326 | 326 | 'attribute' => 'name', |
327 | 327 | |
328 | - 'options' => (fn ($query) => $query->orderBy('level_id', 'ASC')->where('period_id', $this->crud->getCurrentEntry()->course->period_id)->get()), |
|
328 | + 'options' => (fn($query) => $query->orderBy('level_id', 'ASC')->where('period_id', $this->crud->getCurrentEntry()->course->period_id)->get()), |
|
329 | 329 | ]); |
330 | 330 | |
331 | 331 | CRUD::addField(array_merge([ |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | 'attribute' => 'lastname', |
92 | 92 | 'model' => User::class, |
93 | 93 | 'orderable' => true, |
94 | - 'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
94 | + 'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
95 | 95 | ->orderBy('users.lastname', $columnDirection)->select('students.*'), |
96 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
97 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
96 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
97 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
98 | 98 | $q->where('lastname', 'like', '%'.$searchTerm.'%'); |
99 | 99 | }); |
100 | 100 | }, |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | 'attribute' => 'firstname', |
110 | 110 | 'model' => User::class, |
111 | 111 | 'orderable' => true, |
112 | - 'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
112 | + 'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
113 | 113 | ->orderBy('users.firstname', $columnDirection)->select('students.*'), |
114 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
115 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
114 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
115 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
116 | 116 | $q->where('firstname', 'like', '%'.$searchTerm.'%'); |
117 | 117 | }); |
118 | 118 | }, |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | 'attribute' => 'email', |
127 | 127 | 'model' => User::class, |
128 | 128 | 'orderable' => true, |
129 | - 'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
129 | + 'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
130 | 130 | ->orderBy('users.email', $columnDirection)->select('students.*'), |
131 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
132 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
131 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
132 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
133 | 133 | $q->where('email', 'like', '%'.$searchTerm.'%'); |
134 | 134 | }); |
135 | 135 | }, |
@@ -176,28 +176,28 @@ discard block |
||
176 | 176 | ]); |
177 | 177 | |
178 | 178 | CRUD::addFilter( |
179 | - [ // select2 filter |
|
179 | + [// select2 filter |
|
180 | 180 | 'name' => 'enrolled', |
181 | 181 | 'type' => 'select2', |
182 | 182 | 'label'=> __('Is Enrolled in'), |
183 | 183 | ], |
184 | - fn () => Period::all()->pluck('name', 'id')->toArray(), |
|
185 | - function ($value) { // if the filter is active |
|
186 | - $this->crud->query = $this->crud->query->whereHas('enrollments', fn ($query) => $query->whereHas('course', function ($q) use ($value) { |
|
184 | + fn() => Period::all()->pluck('name', 'id')->toArray(), |
|
185 | + function($value) { // if the filter is active |
|
186 | + $this->crud->query = $this->crud->query->whereHas('enrollments', fn($query) => $query->whereHas('course', function($q) use ($value) { |
|
187 | 187 | $q->where('period_id', $value); |
188 | 188 | })); |
189 | 189 | }, |
190 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
190 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
191 | 191 | } |
192 | 192 | ); |
193 | 193 | |
194 | - CRUD::addFilter([ // select2_multiple filter |
|
194 | + CRUD::addFilter([// select2_multiple filter |
|
195 | 195 | 'name' => 'notenrolled', |
196 | 196 | 'type' => 'select2_multiple', |
197 | 197 | 'label'=> __('Is Not Enrolled in'), |
198 | - ], fn () => Period::all()->pluck('name', 'id')->toArray(), function ($values) { // if the filter is active |
|
198 | + ], fn() => Period::all()->pluck('name', 'id')->toArray(), function($values) { // if the filter is active |
|
199 | 199 | foreach (json_decode($values, null, 512, JSON_THROW_ON_ERROR) as $value) { |
200 | - $this->crud->query = $this->crud->query->whereDoesntHave('enrollments', fn ($query) => $query->whereHas('course', function ($q) use ($value) { |
|
200 | + $this->crud->query = $this->crud->query->whereDoesntHave('enrollments', fn($query) => $query->whereHas('course', function($q) use ($value) { |
|
201 | 201 | $q->where('period_id', $value); |
202 | 202 | })); |
203 | 203 | } |
@@ -209,8 +209,8 @@ discard block |
||
209 | 209 | 'type' => 'select2', |
210 | 210 | 'label'=> __('New In'), |
211 | 211 | ], |
212 | - fn () => Period::all()->pluck('name', 'id')->toArray(), |
|
213 | - function ($value) { // if the filter is active |
|
212 | + fn() => Period::all()->pluck('name', 'id')->toArray(), |
|
213 | + function($value) { // if the filter is active |
|
214 | 214 | CRUD::addClause('newInPeriod', $value); |
215 | 215 | } |
216 | 216 | ); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | 'name' => 'institution_id', |
221 | 221 | 'type' => 'select2', |
222 | 222 | 'label' => __('Institution'), |
223 | - ], fn () => Institution::all()->pluck('name', 'id')->toArray(), function ($value) { // if the filter is active |
|
223 | + ], fn() => Institution::all()->pluck('name', 'id')->toArray(), function($value) { // if the filter is active |
|
224 | 224 | $this->crud->addClause('where', 'institution_id', $value); |
225 | 225 | }); |
226 | 226 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | 'name' => 'status_type_id', |
229 | 229 | 'type' => 'select2', |
230 | 230 | 'label' => __('Lead Status'), |
231 | - ], fn () => LeadType::all()->pluck('name', 'id')->toArray(), function ($value) { |
|
231 | + ], fn() => LeadType::all()->pluck('name', 'id')->toArray(), function($value) { |
|
232 | 232 | if ($value === '4') { |
233 | 233 | $this->crud->query = $this->crud->query->where('lead_type_id', $value)->orWhere('lead_type_id', null); |
234 | 234 | } else { |
@@ -344,8 +344,8 @@ discard block |
||
344 | 344 | $username_parts = array_filter(explode(' ', strtolower($fullName))); |
345 | 345 | $username_parts = array_slice($username_parts, -2); |
346 | 346 | |
347 | - $part1 = (! empty($username_parts[0])) ? substr($username_parts[0], 0, 3) : ''; |
|
348 | - $part2 = (! empty($username_parts[1])) ? substr($username_parts[1], 0, 8) : ''; |
|
347 | + $part1 = (!empty($username_parts[0])) ? substr($username_parts[0], 0, 3) : ''; |
|
348 | + $part2 = (!empty($username_parts[1])) ? substr($username_parts[1], 0, 8) : ''; |
|
349 | 349 | $part3 = random_int(999, 9999); |
350 | 350 | |
351 | 351 | $username = $part1.$part2.$part3; //str_shuffle to randomly shuffle all characters |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | { |
434 | 434 | $student = Student::findOrFail($student); |
435 | 435 | |
436 | - if (! backpack_user()->isTeacher() && ! backpack_user()->can('enrollments.view')) { |
|
436 | + if (!backpack_user()->isTeacher() && !backpack_user()->can('enrollments.view')) { |
|
437 | 437 | abort(403); |
438 | 438 | } |
439 | 439 |
@@ -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 |