@@ -15,7 +15,7 @@ |
||
15 | 15 | |
16 | 16 | public function styling() |
17 | 17 | { |
18 | - return match ($this->id) { |
|
18 | + return match($this->id) { |
|
19 | 19 | 1 => 'warning', |
20 | 20 | 2 => 'info', |
21 | 21 | default => 'danger', |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | |
43 | 43 | public function scopeEnrolled($query) |
44 | 44 | { |
45 | - return $query->whereHas('enrollments', function ($q) { |
|
46 | - return $q->whereHas('course', function ($q) { |
|
45 | + return $query->whereHas('enrollments', function($q) { |
|
46 | + return $q->whereHas('course', function($q) { |
|
47 | 47 | return $q->where('period_id', Period::get_default_period()->id); |
48 | 48 | }); |
49 | 49 | }); |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | |
52 | 52 | public function scopeComputedLeadType($query, $leadTypeId) |
53 | 53 | { |
54 | - return match ($leadTypeId) { |
|
55 | - 1 => $query->whereHas('enrollments', fn ($query) => $query->whereHas('course', function ($q) { |
|
54 | + return match($leadTypeId) { |
|
55 | + 1 => $query->whereHas('enrollments', fn($query) => $query->whereHas('course', function($q) { |
|
56 | 56 | $q->where('period_id', Period::get_default_period()->id); |
57 | 57 | })), |
58 | 58 | |
@@ -61,15 +61,15 @@ discard block |
||
61 | 61 | 4 => $query |
62 | 62 | ->where('lead_type_id', $leadTypeId) |
63 | 63 | ->orWhere( |
64 | - function ($query) { |
|
64 | + function($query) { |
|
65 | 65 | $query |
66 | 66 | ->whereNull('lead_type_id') |
67 | - ->whereHas('enrollments', fn ($query) => $query |
|
68 | - ->whereHas('course', function ($q) { |
|
67 | + ->whereHas('enrollments', fn($query) => $query |
|
68 | + ->whereHas('course', function($q) { |
|
69 | 69 | $q->where('period_id', '!=', Period::get_default_period()->id); |
70 | 70 | })) |
71 | - ->whereDoesntHave('enrollments', fn ($query) => $query |
|
72 | - ->whereHas('course', function ($q) { |
|
71 | + ->whereDoesntHave('enrollments', fn($query) => $query |
|
72 | + ->whereHas('course', function($q) { |
|
73 | 73 | $q->where('period_id', Period::get_default_period()->id); |
74 | 74 | })); |
75 | 75 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | return $this->hasMany(Attendance::class) |
112 | 112 | ->where('attendance_type_id', 4) // absence |
113 | - ->whereHas('event', fn ($q) => $q->whereHas('course', fn ($c) => $c->where('period_id', $period->id))); |
|
113 | + ->whereHas('event', fn($q) => $q->whereHas('course', fn($c) => $c->where('period_id', $period->id))); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | public function periodAttendance(Period $period = null) |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | } |
121 | 121 | |
122 | 122 | return $this->hasMany(Attendance::class) |
123 | - ->whereHas('event', fn ($q) => $q->whereHas('course', fn ($c) => $c->where('period_id', $period->id))); |
|
123 | + ->whereHas('event', fn($q) => $q->whereHas('course', fn($c) => $c->where('period_id', $period->id))); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | public function contacts() |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | |
182 | 182 | public function getEmailAttribute(): ?string |
183 | 183 | { |
184 | - return $this?->user?->email; |
|
184 | + return $this ? ->user ? ->email; |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | public function getNameAttribute(): string |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | public function getIsEnrolledAttribute() |
203 | 203 | { |
204 | 204 | // if the student is currently enrolled |
205 | - if ($this->enrollments()->whereHas('course', fn ($q) => $q->where('period_id', Period::get_default_period()->id))->count() > 0) { |
|
205 | + if ($this->enrollments()->whereHas('course', fn($q) => $q->where('period_id', Period::get_default_period()->id))->count() > 0) { |
|
206 | 206 | return 1; |
207 | 207 | } |
208 | 208 | |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | |
302 | 302 | public function getImageAttribute(): ?string |
303 | 303 | { |
304 | - return $this->getMedia('profile-picture')->last()?->getUrl('thumb'); |
|
304 | + return $this->getMedia('profile-picture')->last() ? ->getUrl('thumb'); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | public function setImageAttribute($value) |
@@ -46,7 +46,7 @@ |
||
46 | 46 | ->where('periods.year_id', $this->id) |
47 | 47 | ->whereIn('enrollments.status_id', ['1', '2']) // filter out cancelled enrollments, todo make this configurable. |
48 | 48 | ->where('enrollments.parent_id', null)->where('enrollments.deleted_at', null) |
49 | - ->where(function ($query) { |
|
49 | + ->where(function($query) { |
|
50 | 50 | return $query->where('students.gender_id', 0)->orWhereNull('students.gender_id'); |
51 | 51 | }) |
52 | 52 | ->distinct('student_id')->count('enrollments.student_id'); |
@@ -53,12 +53,12 @@ |
||
53 | 53 | |
54 | 54 | View::composer( |
55 | 55 | ['partials.create_new_contact', 'students.edit-contact'], |
56 | - function ($view) { |
|
56 | + function($view) { |
|
57 | 57 | $view->with('contact_types', ContactRelationship::all()); |
58 | 58 | } |
59 | 59 | ); |
60 | 60 | |
61 | - View::composer('partials.add_book_to_student', function ($view) { |
|
61 | + View::composer('partials.add_book_to_student', function($view) { |
|
62 | 62 | $view->with('books', Book::all()); |
63 | 63 | $view->with('statuses', EnrollmentStatusType::all()); |
64 | 64 | }); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | 'label' => __('Due Date'), |
51 | 51 | ], |
52 | 52 | false, |
53 | - function ($value) { // if the filter is active, apply these constraints |
|
53 | + function($value) { // if the filter is active, apply these constraints |
|
54 | 54 | $this->crud->addClause('where', 'date', '>=', Carbon::parse($value)->firstOfMonth()); |
55 | 55 | $this->crud->addClause('where', 'date', '<=', Carbon::parse($value)->lastOfMonth()); |
56 | 56 | } |
@@ -92,11 +92,11 @@ discard block |
||
92 | 92 | { |
93 | 93 | $payment = Payment::findOrFail($id); |
94 | 94 | |
95 | - if (! backpack_user()->can('enrollments.edit')) { |
|
95 | + if (!backpack_user()->can('enrollments.edit')) { |
|
96 | 96 | abort(403); |
97 | 97 | } |
98 | 98 | |
99 | - if (! $payment->invoice) { |
|
99 | + if (!$payment->invoice) { |
|
100 | 100 | abort(404, 'No enrollment found for this payment'); |
101 | 101 | } |
102 | 102 |
@@ -188,7 +188,7 @@ |
||
188 | 188 | })); |
189 | 189 | }, |
190 | 190 | function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
191 | - } |
|
191 | + } |
|
192 | 192 | ); |
193 | 193 | |
194 | 194 | CRUD::addFilter([ // select2_multiple filter |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | 'attribute' => 'lastname', |
92 | 92 | 'model' => \App\Models\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' => \App\Models\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' => \App\Models\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 |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | 'attribute' => 'lastname', |
44 | 44 | 'label' => __('Last Name'), |
45 | 45 | 'type' => 'relationship', |
46 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
47 | - $query->orWhereHas('enrollment', function ($q) use ($searchTerm) { |
|
48 | - $q->whereHas('user', function ($q) use ($searchTerm) { |
|
46 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
47 | + $query->orWhereHas('enrollment', function($q) use ($searchTerm) { |
|
48 | + $q->whereHas('user', function($q) use ($searchTerm) { |
|
49 | 49 | $q->where('lastname', 'like', '%'.$searchTerm.'%'); |
50 | 50 | }); |
51 | 51 | }); |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | 'attribute' => 'firstname', |
59 | 59 | 'label' => __('First Name'), |
60 | 60 | 'type' => 'relationship', |
61 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
62 | - $query->orWhereHas('enrollment', function ($q) use ($searchTerm) { |
|
63 | - $q->whereHas('user', function ($q) use ($searchTerm) { |
|
61 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
62 | + $query->orWhereHas('enrollment', function($q) use ($searchTerm) { |
|
63 | + $q->whereHas('user', function($q) use ($searchTerm) { |
|
64 | 64 | $q->where('firstname', 'like', '%'.$searchTerm.'%'); |
65 | 65 | }); |
66 | 66 | }); |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | 'attribute' => 'email', |
74 | 74 | 'label' => __('Email'), |
75 | 75 | 'type' => 'relationship', |
76 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
77 | - $query->orWhereHas('enrollment', function ($q) use ($searchTerm) { |
|
78 | - $q->whereHas('user', function ($q) use ($searchTerm) { |
|
76 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
77 | + $query->orWhereHas('enrollment', function($q) use ($searchTerm) { |
|
78 | + $q->whereHas('user', function($q) use ($searchTerm) { |
|
79 | 79 | $q->where('email', 'like', '%'.$searchTerm.'%'); |
80 | 80 | }); |
81 | 81 | }); |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | 'type' => 'select2', |
108 | 108 | 'label'=> __('Status'), |
109 | 109 | ], |
110 | - fn () => [ |
|
110 | + fn() => [ |
|
111 | 111 | 1 => __('Pending'), |
112 | 112 | 2 => __('Paid'), |
113 | 113 | ], |
114 | - function ($value) { // if the filter is active |
|
114 | + function($value) { // if the filter is active |
|
115 | 115 | CRUD::addClause('status', $value); |
116 | 116 | } |
117 | 117 | ); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | CRUD::addClause('internal'); |
55 | 55 | $permissions = backpack_user()->getAllPermissions(); |
56 | 56 | |
57 | - if (! $permissions->contains('name', 'courses.edit')) { |
|
57 | + if (!$permissions->contains('name', 'courses.edit')) { |
|
58 | 58 | CRUD::denyAccess(['update', 'create']); |
59 | 59 | } |
60 | 60 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | CRUD::addButtonFromView('line', 'children_badge', 'children_badge', 'beginning'); |
66 | 66 | |
67 | - if (! $permissions->contains('name', 'courses.delete')) { |
|
67 | + if (!$permissions->contains('name', 'courses.delete')) { |
|
68 | 68 | CRUD::denyAccess(['delete']); |
69 | 69 | } |
70 | 70 | |
@@ -188,12 +188,12 @@ discard block |
||
188 | 188 | 'type' => 'select2', |
189 | 189 | 'label'=> __('Rhythm'), |
190 | 190 | ], |
191 | - fn () => Rhythm::all()->pluck('name', 'id')->toArray(), |
|
192 | - function ($value) { |
|
191 | + fn() => Rhythm::all()->pluck('name', 'id')->toArray(), |
|
192 | + function($value) { |
|
193 | 193 | // if the filter is active |
194 | 194 | CRUD::addClause('where', 'rhythm_id', $value); |
195 | 195 | }, |
196 | - function () { |
|
196 | + function() { |
|
197 | 197 | // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
198 | 198 | } |
199 | 199 | ); |
@@ -204,12 +204,12 @@ discard block |
||
204 | 204 | 'type' => 'select2', |
205 | 205 | 'label'=> __('Teacher'), |
206 | 206 | ], |
207 | - fn () => Teacher::all()->pluck('name', 'id')->toArray(), |
|
208 | - function ($value) { |
|
207 | + fn() => Teacher::all()->pluck('name', 'id')->toArray(), |
|
208 | + function($value) { |
|
209 | 209 | // if the filter is active |
210 | 210 | CRUD::addClause('where', 'teacher_id', $value); |
211 | 211 | }, |
212 | - function () { |
|
212 | + function() { |
|
213 | 213 | // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
214 | 214 | } |
215 | 215 | ); |
@@ -220,12 +220,12 @@ discard block |
||
220 | 220 | 'type' => 'select2', |
221 | 221 | 'label'=> __('Level'), |
222 | 222 | ], |
223 | - fn () => Level::all()->pluck('name', 'id')->toArray(), |
|
224 | - function ($value) { |
|
223 | + fn() => Level::all()->pluck('name', 'id')->toArray(), |
|
224 | + function($value) { |
|
225 | 225 | // if the filter is active |
226 | 226 | CRUD::addClause('where', 'level_id', $value); |
227 | 227 | }, |
228 | - function () { |
|
228 | + function() { |
|
229 | 229 | // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
230 | 230 | } |
231 | 231 | ); |
@@ -236,11 +236,11 @@ discard block |
||
236 | 236 | 'type' => 'select2', |
237 | 237 | 'label'=> __('Period'), |
238 | 238 | ], |
239 | - fn () => \App\Models\Period::all()->sortByDesc('id')->pluck('name', 'id')->toArray(), |
|
240 | - function ($value) { // if the filter is active |
|
239 | + fn() => \App\Models\Period::all()->sortByDesc('id')->pluck('name', 'id')->toArray(), |
|
240 | + function($value) { // if the filter is active |
|
241 | 241 | CRUD::addClause('where', 'period_id', $value); |
242 | 242 | }, |
243 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
243 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
244 | 244 | $period = \App\Models\Period::get_default_period()->id; |
245 | 245 | CRUD::addClause('where', 'period_id', $period); |
246 | 246 | $this->crud->getRequest()->request->add(['period_id' => $period]); // to make the filter look active |
@@ -248,13 +248,13 @@ discard block |
||
248 | 248 | ); |
249 | 249 | |
250 | 250 | CRUD::addFilter( |
251 | - [ // add a "simple" filter called Draft |
|
251 | + [// add a "simple" filter called Draft |
|
252 | 252 | 'type' => 'simple', |
253 | 253 | 'name' => 'parent', |
254 | 254 | 'label'=> __('Hide Children Courses'), |
255 | 255 | ], |
256 | 256 | false, |
257 | - function () { |
|
257 | + function() { |
|
258 | 258 | CRUD::addClause('parent'); |
259 | 259 | } |
260 | 260 | ); |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | 'label' => __('Start'), |
267 | 267 | ], |
268 | 268 | false, |
269 | - function ($value) { // if the filter is active, apply these constraints |
|
269 | + function($value) { // if the filter is active, apply these constraints |
|
270 | 270 | $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR); |
271 | 271 | $this->crud->addClause('where', 'start_date', '>=', $dates->from); |
272 | 272 | $this->crud->addClause('where', 'start_date', '<=', $dates->to.' 23:59:59'); |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | 'label' => __('End'), |
281 | 281 | ], |
282 | 282 | false, |
283 | - function ($value) { // if the filter is active, apply these constraints |
|
283 | + function($value) { // if the filter is active, apply these constraints |
|
284 | 284 | $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR); |
285 | 285 | $this->crud->addClause('where', 'end_date', '>=', $dates->from); |
286 | 286 | $this->crud->addClause('where', 'end_date', '<=', $dates->to.' 23:59:59'); |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | 'tab' => __('Course info'), |
378 | 378 | ], |
379 | 379 | |
380 | - [ // repeatable |
|
380 | + [// repeatable |
|
381 | 381 | 'name' => 'sublevels', |
382 | 382 | 'label' => __('Course sublevels'), |
383 | 383 | 'type' => 'repeatable', |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | 'default' => Period::get_enrollments_period()->end, |
535 | 535 | ], |
536 | 536 | |
537 | - [ // repeatable |
|
537 | + [// repeatable |
|
538 | 538 | 'name' => 'times', |
539 | 539 | 'label' => __('Course Schedule'), |
540 | 540 | 'type' => 'repeatable', |
@@ -597,14 +597,14 @@ discard block |
||
597 | 597 | 'init_rows' => 0, // number of empty rows to be initialized, by default 1 |
598 | 598 | ], |
599 | 599 | |
600 | - [ // view |
|
600 | + [// view |
|
601 | 601 | 'name' => 'custom-ajax-button', |
602 | 602 | 'type' => 'view', |
603 | 603 | 'view' => 'courses/schedule-preset-alert', |
604 | 604 | 'tab' => __('Schedule'), |
605 | 605 | ], |
606 | 606 | |
607 | - [ // select_from_array |
|
607 | + [// select_from_array |
|
608 | 608 | 'name' => 'schedulepreset', |
609 | 609 | 'label' => __('Schedule Preset'), |
610 | 610 | 'type' => 'select_from_array', |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | } |
629 | 629 | |
630 | 630 | if ($this->crud->getCurrentEntry()->children->count() > 0) { |
631 | - CRUD::addField([ // view |
|
631 | + CRUD::addField([// view |
|
632 | 632 | 'name' => 'custom-ajax-button', |
633 | 633 | 'type' => 'view', |
634 | 634 | 'view' => 'courses/parent-course-alert', |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | } |
637 | 637 | |
638 | 638 | if ($this->crud->getCurrentEntry()->parent_course_id !== null) { |
639 | - CRUD::addField([ // view |
|
639 | + CRUD::addField([// view |
|
640 | 640 | 'name' => 'custom-ajax-button', |
641 | 641 | 'type' => 'view', |
642 | 642 | 'view' => 'courses/child-course-alert', |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | ], |
94 | 94 | false, |
95 | 95 | function () { // if the filter is active |
96 | - CRUD::addClause('where', 'action', true); |
|
97 | - } |
|
96 | + CRUD::addClause('where', 'action', true); |
|
97 | + } |
|
98 | 98 | ); |
99 | 99 | |
100 | 100 | CRUD::addFilter( |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | CRUD::addClause('where', 'commentable_type', '=', $value); |
115 | 115 | }, |
116 | 116 | function () { // if the filter is not active |
117 | - CRUD::addClause('where', 'commentable_type', '=', Student::class); |
|
118 | - $this->crud->getRequest()->request->add(['commentable_type' => Student::class]); // to make the filter look active |
|
119 | - } |
|
117 | + CRUD::addClause('where', 'commentable_type', '=', Student::class); |
|
118 | + $this->crud->getRequest()->request->add(['commentable_type' => Student::class]); // to make the filter look active |
|
119 | + } |
|
120 | 120 | ); |
121 | 121 | } |
122 | 122 |
@@ -86,19 +86,19 @@ discard block |
||
86 | 86 | ]); |
87 | 87 | |
88 | 88 | CRUD::addFilter( |
89 | - [ // simple filter |
|
89 | + [// simple filter |
|
90 | 90 | 'type' => 'simple', |
91 | 91 | 'name' => 'action', |
92 | 92 | 'label'=> 'Action', |
93 | 93 | ], |
94 | 94 | false, |
95 | - function () { // if the filter is active |
|
95 | + function() { // if the filter is active |
|
96 | 96 | CRUD::addClause('where', 'action', true); |
97 | 97 | } |
98 | 98 | ); |
99 | 99 | |
100 | 100 | CRUD::addFilter( |
101 | - [ // dropdown filter |
|
101 | + [// dropdown filter |
|
102 | 102 | 'name' => 'type', |
103 | 103 | 'type' => 'dropdown', |
104 | 104 | 'label'=> 'Type', |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | Result::class => 'Result', |
111 | 111 | |
112 | 112 | ], |
113 | - function ($value) { // if the filter is active |
|
113 | + function($value) { // if the filter is active |
|
114 | 114 | CRUD::addClause('where', 'commentable_type', '=', $value); |
115 | 115 | }, |
116 | - function () { // if the filter is not active |
|
116 | + function() { // if the filter is not active |
|
117 | 117 | CRUD::addClause('where', 'commentable_type', '=', Student::class); |
118 | 118 | $this->crud->getRequest()->request->add(['commentable_type' => Student::class]); // to make the filter look active |
119 | 119 | } |