@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | 'attribute' => 'lastname', |
49 | 49 | 'label' => __('Last Name'), |
50 | 50 | 'type' => 'relationship', |
51 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
52 | - $query->orWhereHas('enrollment', function ($q) use ($searchTerm) { |
|
53 | - $q->whereHas('user', function ($q) use ($searchTerm) { |
|
51 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
52 | + $query->orWhereHas('enrollment', function($q) use ($searchTerm) { |
|
53 | + $q->whereHas('user', function($q) use ($searchTerm) { |
|
54 | 54 | $q->where('lastname', 'like', '%'.$searchTerm.'%'); |
55 | 55 | }); |
56 | 56 | }); |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | 'attribute' => 'firstname', |
64 | 64 | 'label' => __('First Name'), |
65 | 65 | 'type' => 'relationship', |
66 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
67 | - $query->orWhereHas('enrollment', function ($q) use ($searchTerm) { |
|
68 | - $q->whereHas('user', function ($q) use ($searchTerm) { |
|
66 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
67 | + $query->orWhereHas('enrollment', function($q) use ($searchTerm) { |
|
68 | + $q->whereHas('user', function($q) use ($searchTerm) { |
|
69 | 69 | $q->where('firstname', 'like', '%'.$searchTerm.'%'); |
70 | 70 | }); |
71 | 71 | }); |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | 'attribute' => 'email', |
79 | 79 | 'label' => __('Email'), |
80 | 80 | 'type' => 'relationship', |
81 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
82 | - $query->orWhereHas('enrollment', function ($q) use ($searchTerm) { |
|
83 | - $q->whereHas('user', function ($q) use ($searchTerm) { |
|
81 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
82 | + $query->orWhereHas('enrollment', function($q) use ($searchTerm) { |
|
83 | + $q->whereHas('user', function($q) use ($searchTerm) { |
|
84 | 84 | $q->where('email', 'like', '%'.$searchTerm.'%'); |
85 | 85 | }); |
86 | 86 | }); |
@@ -113,11 +113,11 @@ discard block |
||
113 | 113 | 'type' => 'select2', |
114 | 114 | 'label' => __('Status'), |
115 | 115 | ], |
116 | - fn () => [ |
|
116 | + fn() => [ |
|
117 | 117 | 1 => __('Pending'), |
118 | 118 | 2 => __('Paid'), |
119 | 119 | ], |
120 | - function ($value) { |
|
120 | + function($value) { |
|
121 | 121 | CRUD::addClause('status', $value); |
122 | 122 | } |
123 | 123 | ); |
@@ -75,7 +75,7 @@ |
||
75 | 75 | 'type' => 'relationship', |
76 | 76 | 'name' => 'category', |
77 | 77 | 'ajax' => true, |
78 | - 'inline_create' => [ // specify the entity in singular |
|
78 | + 'inline_create' => [// specify the entity in singular |
|
79 | 79 | 'entity' => 'gradetypecategory', |
80 | 80 | // the entity in singular |
81 | 81 | // OPTIONALS |
@@ -104,7 +104,7 @@ |
||
104 | 104 | 'type' => 'date', |
105 | 105 | ]); |
106 | 106 | |
107 | - CRUD::addField([ // Checkbox |
|
107 | + CRUD::addField([// Checkbox |
|
108 | 108 | 'name' => 'auto_renewal', |
109 | 109 | 'label' => __('Tacit renewal'), |
110 | 110 | 'type' => 'checkbox', |
@@ -175,58 +175,58 @@ discard block |
||
175 | 175 | ]); |
176 | 176 | |
177 | 177 | CRUD::addFilter( |
178 | - [ // select2 filter |
|
178 | + [// select2 filter |
|
179 | 179 | 'name' => 'rhythm_id', |
180 | 180 | 'type' => 'select2', |
181 | 181 | 'label' => __('Rhythm'), |
182 | 182 | ], |
183 | - fn () => Rhythm::all()->pluck('name', 'id')->toArray(), |
|
184 | - function ($value) { |
|
183 | + fn() => Rhythm::all()->pluck('name', 'id')->toArray(), |
|
184 | + function($value) { |
|
185 | 185 | CRUD::addClause('where', 'rhythm_id', $value); |
186 | 186 | }, |
187 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
187 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
188 | 188 | } |
189 | 189 | ); |
190 | 190 | |
191 | 191 | CRUD::addFilter( |
192 | - [ // select2 filter |
|
192 | + [// select2 filter |
|
193 | 193 | 'name' => 'teacher_id', |
194 | 194 | 'type' => 'select2', |
195 | 195 | 'label' => __('Teacher'), |
196 | 196 | ], |
197 | - fn () => Teacher::all()->pluck('name', 'id')->toArray(), |
|
198 | - function ($value) { |
|
197 | + fn() => Teacher::all()->pluck('name', 'id')->toArray(), |
|
198 | + function($value) { |
|
199 | 199 | CRUD::addClause('where', 'teacher_id', $value); |
200 | 200 | }, |
201 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
201 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
202 | 202 | } |
203 | 203 | ); |
204 | 204 | |
205 | 205 | CRUD::addFilter( |
206 | - [ // select2 filter |
|
206 | + [// select2 filter |
|
207 | 207 | 'name' => 'level_id', |
208 | 208 | 'type' => 'select2', |
209 | 209 | 'label' => __('Level'), |
210 | 210 | ], |
211 | - fn () => Level::all()->pluck('name', 'id')->toArray(), |
|
212 | - function ($value) { |
|
211 | + fn() => Level::all()->pluck('name', 'id')->toArray(), |
|
212 | + function($value) { |
|
213 | 213 | CRUD::addClause('where', 'level_id', $value); |
214 | 214 | }, |
215 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
215 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
216 | 216 | } |
217 | 217 | ); |
218 | 218 | |
219 | 219 | CRUD::addFilter( |
220 | - [ // select2 filter |
|
220 | + [// select2 filter |
|
221 | 221 | 'name' => 'period_id', |
222 | 222 | 'type' => 'select2', |
223 | 223 | 'label' => __('Period'), |
224 | 224 | ], |
225 | - fn () => Period::all()->pluck('name', 'id')->toArray(), |
|
226 | - function ($value) { |
|
225 | + fn() => Period::all()->pluck('name', 'id')->toArray(), |
|
226 | + function($value) { |
|
227 | 227 | CRUD::addClause('where', 'period_id', $value); |
228 | 228 | }, |
229 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
229 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
230 | 230 | $period = Period::get_default_period()->id; |
231 | 231 | CRUD::addClause('where', 'period_id', $period); |
232 | 232 | $this->crud->getRequest()->request->add(['period_id' => $period]); // to make the filter look active |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | 'tab' => __('Course info'), |
381 | 381 | ], |
382 | 382 | |
383 | - [ // repeatable |
|
383 | + [// repeatable |
|
384 | 384 | 'name' => 'times', |
385 | 385 | 'label' => __('Course Schedule'), |
386 | 386 | 'type' => 'repeatable', |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | 'tab' => __('Schedule'), |
420 | 420 | ], |
421 | 421 | |
422 | - [ // view |
|
422 | + [// view |
|
423 | 423 | 'name' => 'custom-ajax-button', |
424 | 424 | 'type' => 'view', |
425 | 425 | 'view' => 'courses/schedule-preset-alert', |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | 'tab' => __('Course info'), |
582 | 582 | ], |
583 | 583 | |
584 | - [ // repeatable |
|
584 | + [// repeatable |
|
585 | 585 | 'name' => 'times', |
586 | 586 | 'label' => __('Course Schedule'), |
587 | 587 | 'type' => 'repeatable', |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | 'label' => trans('backpack::permissionmanager.email'), |
49 | 49 | 'type' => 'email', |
50 | 50 | ], |
51 | - [ // n-n relationship (with pivot table) |
|
51 | + [// n-n relationship (with pivot table) |
|
52 | 52 | 'label' => trans('backpack::permissionmanager.roles'), |
53 | 53 | 'type' => 'select_multiple', |
54 | 54 | 'name' => 'roles', |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | 'label' => trans('backpack::permissionmanager.role'), |
68 | 68 | ], |
69 | 69 | config('permission.models.role')::all()->pluck(['name', 'id'])->toArray(), |
70 | - function ($value) { |
|
71 | - $this->crud->addClause('whereHas', 'roles', function ($query) use ($value) { |
|
70 | + function($value) { |
|
71 | + $this->crud->addClause('whereHas', 'roles', function($query) use ($value) { |
|
72 | 72 | $query->where('role_id', '=', $value); |
73 | 73 | }); |
74 | 74 | } |
@@ -119,12 +119,12 @@ discard block |
||
119 | 119 | protected function addFields() |
120 | 120 | { |
121 | 121 | $this->crud->addFields([ |
122 | - [ // Select2 |
|
122 | + [// Select2 |
|
123 | 123 | 'label' => trans('firstname'), |
124 | 124 | 'type' => 'text', |
125 | 125 | 'name' => 'firstname', |
126 | 126 | ], |
127 | - [ // Select2 |
|
127 | + [// Select2 |
|
128 | 128 | 'label' => trans('lastname'), |
129 | 129 | 'type' => 'text', |
130 | 130 | 'name' => 'lastname', |
@@ -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 () { |
|
95 | + function() { |
|
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) { |
|
113 | + function($value) { |
|
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 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | 'label' => 'Name', |
40 | 40 | 'type' => 'text', ]); |
41 | 41 | |
42 | - CRUD::addField([ // Select2Multiple = n-n relationship (with pivot table) |
|
42 | + CRUD::addField([// Select2Multiple = n-n relationship (with pivot table) |
|
43 | 43 | 'label' => __('Grade Types'), |
44 | 44 | 'type' => 'select2_multiple', |
45 | 45 | 'name' => 'gradeTypes', |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | // show Select All and Clear buttons? |
55 | 55 | ]); |
56 | 56 | |
57 | - CRUD::addField([ // Select2Multiple = n-n relationship (with pivot table) |
|
57 | + CRUD::addField([// Select2Multiple = n-n relationship (with pivot table) |
|
58 | 58 | 'label' => __('Skills'), |
59 | 59 | 'type' => 'select2_multiple', |
60 | 60 | 'name' => 'skills', |
@@ -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) { |
|
118 | + ], fn() => Period::all()->pluck('name', 'id')->toArray(), function($value) { |
|
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) { |
|
127 | - $this->crud->query = $this->crud->query->whereHas('result', function ($query) use ($value) { |
|
126 | + ], fn() => ResultType::all()->pluck('name', 'id')->toArray(), function($value) { |
|
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 | }); |
@@ -69,27 +69,27 @@ discard block |
||
69 | 69 | ]); |
70 | 70 | |
71 | 71 | CRUD::addFilter( |
72 | - [ // select2 filter |
|
72 | + [// select2 filter |
|
73 | 73 | 'name' => 'teacher_id', |
74 | 74 | 'type' => 'select2', |
75 | 75 | 'label' => __('Teacher'), |
76 | 76 | ], |
77 | - fn () => Teacher::all()->pluck('name', 'id')->toArray(), |
|
78 | - function ($value) { |
|
77 | + fn() => Teacher::all()->pluck('name', 'id')->toArray(), |
|
78 | + function($value) { |
|
79 | 79 | CRUD::addClause('where', 'teacher_id', $value); |
80 | 80 | }, |
81 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
81 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
82 | 82 | } |
83 | 83 | ); |
84 | 84 | |
85 | 85 | CRUD::addFilter( |
86 | - [ // daterange filter |
|
86 | + [// daterange filter |
|
87 | 87 | 'type' => 'date_range', |
88 | 88 | 'name' => 'from_to', |
89 | 89 | 'label' => __('Date range'), |
90 | 90 | ], |
91 | 91 | false, |
92 | - function ($value) { // if the filter is active, apply these constraints |
|
92 | + function($value) { // if the filter is active, apply these constraints |
|
93 | 93 | $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR); |
94 | 94 | CRUD::addClause('where', 'date', '>=', $dates->from); |
95 | 95 | CRUD::addClause('where', 'date', '<=', $dates->to.' 23:59:59'); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | 'model' => LeaveType::class, |
123 | 123 | ], |
124 | 124 | |
125 | - [ // date_range |
|
125 | + [// date_range |
|
126 | 126 | 'name' => ['start_date', 'end_date'], |
127 | 127 | // db columns for start_date & end_date |
128 | 128 | 'label' => 'Event Date Range', |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | 'model' => LeaveType::class, |
169 | 169 | ], |
170 | 170 | |
171 | - [ // datepicker |
|
171 | + [// datepicker |
|
172 | 172 | 'name' => 'date', |
173 | 173 | 'label' => 'Event Date', |
174 | 174 | 'type' => 'date', |