@@ -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 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | CRUD::addClause('where', 'teacher_id', $value); |
79 | 79 | }, |
80 | 80 | function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
81 | - } |
|
81 | + } |
|
82 | 82 | ); |
83 | 83 | |
84 | 84 | CRUD::addFilter( |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | ], |
90 | 90 | false, |
91 | 91 | function ($value) { // if the filter is active, apply these constraints |
92 | - $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR); |
|
93 | - CRUD::addClause('where', 'date', '>=', $dates->from); |
|
94 | - CRUD::addClause('where', 'date', '<=', $dates->to.' 23:59:59'); |
|
95 | - } |
|
92 | + $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR); |
|
93 | + CRUD::addClause('where', 'date', '>=', $dates->from); |
|
94 | + CRUD::addClause('where', 'date', '<=', $dates->to.' 23:59:59'); |
|
95 | + } |
|
96 | 96 | ); |
97 | 97 | } |
98 | 98 |
@@ -68,27 +68,27 @@ discard block |
||
68 | 68 | ]); |
69 | 69 | |
70 | 70 | CRUD::addFilter( |
71 | - [ // select2 filter |
|
71 | + [// select2 filter |
|
72 | 72 | 'name' => 'teacher_id', |
73 | 73 | 'type' => 'select2', |
74 | 74 | 'label'=> __('Teacher'), |
75 | 75 | ], |
76 | - fn () => Teacher::all()->pluck('name', 'id')->toArray(), |
|
77 | - function ($value) { // if the filter is active |
|
76 | + fn() => Teacher::all()->pluck('name', 'id')->toArray(), |
|
77 | + function($value) { // if the filter is active |
|
78 | 78 | CRUD::addClause('where', 'teacher_id', $value); |
79 | 79 | }, |
80 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
80 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
81 | 81 | } |
82 | 82 | ); |
83 | 83 | |
84 | 84 | CRUD::addFilter( |
85 | - [ // daterange filter |
|
85 | + [// daterange filter |
|
86 | 86 | 'type' => 'date_range', |
87 | 87 | 'name' => 'from_to', |
88 | 88 | 'label'=> __('Date range'), |
89 | 89 | ], |
90 | 90 | false, |
91 | - function ($value) { // if the filter is active, apply these constraints |
|
91 | + function($value) { // if the filter is active, apply these constraints |
|
92 | 92 | $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR); |
93 | 93 | CRUD::addClause('where', 'date', '>=', $dates->from); |
94 | 94 | CRUD::addClause('where', 'date', '<=', $dates->to.' 23:59:59'); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | 'model' => LeaveType::class, |
122 | 122 | ], |
123 | 123 | |
124 | - [ // date_range |
|
124 | + [// date_range |
|
125 | 125 | 'name' => ['start_date', 'end_date'], // db columns for start_date & end_date |
126 | 126 | 'label' => 'Event Date Range', |
127 | 127 | 'type' => 'date_range', |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | 'model' => LeaveType::class, |
166 | 166 | ], |
167 | 167 | |
168 | - [ // datepicker |
|
168 | + [// datepicker |
|
169 | 169 | 'name' => 'date', |
170 | 170 | 'label' => 'Event Date', |
171 | 171 | 'type' => 'date', |
@@ -119,15 +119,15 @@ discard block |
||
119 | 119 | ], |
120 | 120 | false, |
121 | 121 | function ($value) { // if the filter is active, apply these constraints |
122 | - $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR); |
|
123 | - |
|
124 | - if ($dates->from) { |
|
125 | - CRUD::addClause('where', 'start', '>=', $dates->from); |
|
126 | - } |
|
127 | - if ($dates->to) { |
|
128 | - CRUD::addClause('where', 'start', '<=', $dates->to.' 23:59:59'); |
|
129 | - } |
|
130 | - } |
|
122 | + $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR); |
|
123 | + |
|
124 | + if ($dates->from) { |
|
125 | + CRUD::addClause('where', 'start', '>=', $dates->from); |
|
126 | + } |
|
127 | + if ($dates->to) { |
|
128 | + CRUD::addClause('where', 'start', '<=', $dates->to.' 23:59:59'); |
|
129 | + } |
|
130 | + } |
|
131 | 131 | ); |
132 | 132 | |
133 | 133 | CRUD::addFilter( |
@@ -138,10 +138,10 @@ discard block |
||
138 | 138 | ], |
139 | 139 | false, |
140 | 140 | function ($value) { // if the filter is active, apply these constraints |
141 | - $this->crud->query->where('course_id', null); |
|
142 | - }, |
|
141 | + $this->crud->query->where('course_id', null); |
|
142 | + }, |
|
143 | 143 | function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
144 | - } |
|
144 | + } |
|
145 | 145 | ); |
146 | 146 | |
147 | 147 | CRUD::addFilter( |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | ], |
153 | 153 | false, |
154 | 154 | function ($value) { // if the filter is active, apply these constraints |
155 | - CRUD::addClause('unassigned'); |
|
156 | - } |
|
155 | + CRUD::addClause('unassigned'); |
|
156 | + } |
|
157 | 157 | ); |
158 | 158 | |
159 | 159 | CRUD::addFilter( |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | CRUD::addClause('where', 'teacher_id', $value); |
168 | 168 | }, |
169 | 169 | function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
170 | - } |
|
170 | + } |
|
171 | 171 | ); |
172 | 172 | } |
173 | 173 |
@@ -112,13 +112,13 @@ discard block |
||
112 | 112 | ]); |
113 | 113 | |
114 | 114 | CRUD::addFilter( |
115 | - [ // daterange filter |
|
115 | + [// daterange filter |
|
116 | 116 | 'type' => 'date_range', |
117 | 117 | 'name' => 'from_to', |
118 | 118 | 'label'=> __('Date range'), |
119 | 119 | ], |
120 | 120 | false, |
121 | - function ($value) { // if the filter is active, apply these constraints |
|
121 | + function($value) { // if the filter is active, apply these constraints |
|
122 | 122 | $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR); |
123 | 123 | |
124 | 124 | if ($dates->from) { |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | 'label'=> __('Events with no course'), |
138 | 138 | ], |
139 | 139 | false, |
140 | - function ($value) { // if the filter is active, apply these constraints |
|
140 | + function($value) { // if the filter is active, apply these constraints |
|
141 | 141 | $this->crud->query->where('course_id', null); |
142 | 142 | }, |
143 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
143 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
144 | 144 | } |
145 | 145 | ); |
146 | 146 | |
@@ -151,22 +151,22 @@ discard block |
||
151 | 151 | 'label'=> __('Events with no teacher'), |
152 | 152 | ], |
153 | 153 | false, |
154 | - function ($value) { // if the filter is active, apply these constraints |
|
154 | + function($value) { // if the filter is active, apply these constraints |
|
155 | 155 | CRUD::addClause('unassigned'); |
156 | 156 | } |
157 | 157 | ); |
158 | 158 | |
159 | 159 | CRUD::addFilter( |
160 | - [ // select2 filter |
|
160 | + [// select2 filter |
|
161 | 161 | 'name' => 'teacher_id', |
162 | 162 | 'type' => 'select2', |
163 | 163 | 'label'=> __('Teacher'), |
164 | 164 | ], |
165 | - fn () => Teacher::all()->pluck('name', 'id')->toArray(), |
|
166 | - function ($value) { // if the filter is active |
|
165 | + fn() => Teacher::all()->pluck('name', 'id')->toArray(), |
|
166 | + function($value) { // if the filter is active |
|
167 | 167 | CRUD::addClause('where', 'teacher_id', $value); |
168 | 168 | }, |
169 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
169 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
170 | 170 | } |
171 | 171 | ); |
172 | 172 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $q->where('firstname', 'like', '%'.$searchTerm.'%') |
59 | 59 | ->orWhere('lastname', 'like', '%'.$searchTerm.'%') |
60 | 60 | ->orWhere('email', 'like', '%'.$searchTerm.'%') |
61 | - ->orWhere('idnumber', 'like', '%'.$searchTerm.'%'); |
|
61 | + ->orWhere('idnumber', 'like', '%'.$searchTerm.'%'); |
|
62 | 62 | }); |
63 | 63 | }); |
64 | 64 | }, |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | ], |
96 | 96 | false, |
97 | 97 | function () { |
98 | - CRUD::addClause('noResult'); |
|
99 | - } |
|
98 | + CRUD::addClause('noResult'); |
|
99 | + } |
|
100 | 100 | ); |
101 | 101 | |
102 | 102 | CRUD::addFilter( |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | 'type' => 'select', |
53 | 53 | 'name' => 'student', |
54 | 54 | 'attribute' => 'name', |
55 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
56 | - $query->orWhereHas('student', function ($q) use ($searchTerm) { |
|
57 | - $q->WhereHas('user', function ($q) use ($searchTerm) { |
|
55 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
56 | + $query->orWhereHas('student', function($q) use ($searchTerm) { |
|
57 | + $q->WhereHas('user', function($q) use ($searchTerm) { |
|
58 | 58 | $q->where('firstname', 'like', '%'.$searchTerm.'%') |
59 | 59 | ->orWhere('lastname', 'like', '%'.$searchTerm.'%') |
60 | 60 | ->orWhere('email', 'like', '%'.$searchTerm.'%') |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | 'label'=> __('No Result'), |
95 | 95 | ], |
96 | 96 | false, |
97 | - function () { |
|
97 | + function() { |
|
98 | 98 | CRUD::addClause('noResult'); |
99 | 99 | } |
100 | 100 | ); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | 'label'=> __('Hide Parents'), |
107 | 107 | ], |
108 | 108 | false, |
109 | - function () { |
|
109 | + function() { |
|
110 | 110 | CRUD::addClause('real'); |
111 | 111 | } |
112 | 112 | ); |
@@ -115,16 +115,16 @@ discard block |
||
115 | 115 | 'name' => 'period_id', |
116 | 116 | 'type' => 'select2', |
117 | 117 | 'label'=> __('Period'), |
118 | - ], fn () => Period::all()->pluck('name', 'id')->toArray(), function ($value) { // if the filter is active |
|
118 | + ], fn() => Period::all()->pluck('name', 'id')->toArray(), function($value) { // if the filter is active |
|
119 | 119 | CRUD::addClause('period', $value); |
120 | 120 | }); |
121 | 121 | |
122 | - CRUD::addFilter([ // select2_multiple filter |
|
122 | + CRUD::addFilter([// select2_multiple filter |
|
123 | 123 | 'name' => 'result', |
124 | 124 | 'type' => 'select2', |
125 | 125 | 'label'=> __('Result'), |
126 | - ], fn () => ResultType::all()->pluck('name', 'id')->toArray(), function ($value) { // if the filter is active |
|
127 | - $this->crud->query = $this->crud->query->whereHas('result', function ($query) use ($value) { |
|
126 | + ], fn() => ResultType::all()->pluck('name', 'id')->toArray(), function($value) { // if the filter is active |
|
127 | + $this->crud->query = $this->crud->query->whereHas('result', function($query) use ($value) { |
|
128 | 128 | $query->where('result_type_id', $value); |
129 | 129 | }); |
130 | 130 | }); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $year_data = []; |
64 | 64 | $years = []; // New array |
65 | 65 | |
66 | - if (! isset($request->period)) { |
|
66 | + if (!isset($request->period)) { |
|
67 | 67 | $startperiod = Period::find(Config::where('name', 'first_external_period')->first()->value ?? Period::first()->id); |
68 | 68 | } else { |
69 | 69 | $startperiod = Period::find($request->period); |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | ->where('id', '>=', $startperiod->id) |
204 | 204 | ->get() |
205 | 205 | ->groupBy('year_id') |
206 | - ->map(function ($yearData) { |
|
206 | + ->map(function($yearData) { |
|
207 | 207 | $yearPeriods = []; |
208 | 208 | |
209 | 209 | foreach ($yearData as $period) { |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | |
308 | 308 | private function getStartperiod(Request $request) |
309 | 309 | { |
310 | - if (! isset($request->period)) { |
|
310 | + if (!isset($request->period)) { |
|
311 | 311 | $startperiod = Period::find(Config::where('name', 'first_period')->first()->value); |
312 | 312 | } else { |
313 | 313 | $startperiod = Period::find($request->period); |