@@ -135,7 +135,7 @@ |
||
| 135 | 135 | |
| 136 | 136 | public function import(Course $course, Request $request) |
| 137 | 137 | { |
| 138 | - if (! $request->hasFile('skillset')) { |
|
| 138 | + if (!$request->hasFile('skillset')) { |
|
| 139 | 139 | abort(422, 'No file has been uploaded'); |
| 140 | 140 | } |
| 141 | 141 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | public function update(Contact $contact, Request $request) |
| 58 | 58 | { |
| 59 | 59 | // check if the user is allowed to edit the contact |
| 60 | - if (! backpack_user()->can('update', $contact)) { |
|
| 60 | + if (!backpack_user()->can('update', $contact)) { |
|
| 61 | 61 | abort(403); |
| 62 | 62 | } |
| 63 | 63 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | public function edit(Contact $contact) |
| 96 | 96 | { |
| 97 | 97 | // check if the user is allowed to edit the contact |
| 98 | - if (! backpack_user()->can('update', $contact)) { |
|
| 98 | + if (!backpack_user()->can('update', $contact)) { |
|
| 99 | 99 | abort(403); |
| 100 | 100 | } |
| 101 | 101 | |
@@ -136,8 +136,8 @@ |
||
| 136 | 136 | }); |
| 137 | 137 | }); |
| 138 | 138 | }, |
| 139 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 140 | - }); |
|
| 139 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 140 | + }); |
|
| 141 | 141 | |
| 142 | 142 | CRUD::addFilter([ // select2_multiple filter |
| 143 | 143 | 'name' => 'notenrolled', |
@@ -88,12 +88,12 @@ discard block |
||
| 88 | 88 | 'attribute' => 'lastname', // foreign key attribute that is shown to user |
| 89 | 89 | 'model' => 'App\Models\User', // foreign key model |
| 90 | 90 | 'orderable' => true, |
| 91 | - 'orderLogic' => function ($query, $column, $columnDirection) { |
|
| 91 | + 'orderLogic' => function($query, $column, $columnDirection) { |
|
| 92 | 92 | return $query->leftJoin('users', 'users.id', '=', 'students.id') |
| 93 | 93 | ->orderBy('users.lastname', $columnDirection)->select('students.*'); |
| 94 | 94 | }, |
| 95 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 96 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 95 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 96 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 97 | 97 | $q->where('lastname', 'like', '%'.$searchTerm.'%'); |
| 98 | 98 | }); |
| 99 | 99 | }, |
@@ -108,12 +108,12 @@ discard block |
||
| 108 | 108 | 'attribute' => 'firstname', // foreign key attribute that is shown to user |
| 109 | 109 | 'model' => 'App\Models\User', // foreign key model |
| 110 | 110 | 'orderable' => true, |
| 111 | - 'orderLogic' => function ($query, $column, $columnDirection) { |
|
| 111 | + 'orderLogic' => function($query, $column, $columnDirection) { |
|
| 112 | 112 | return $query->leftJoin('users', 'users.id', '=', 'students.id') |
| 113 | 113 | ->orderBy('users.firstname', $columnDirection)->select('students.*'); |
| 114 | 114 | }, |
| 115 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 116 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 115 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 116 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 117 | 117 | $q->where('firstname', 'like', '%'.$searchTerm.'%'); |
| 118 | 118 | }); |
| 119 | 119 | }, |
@@ -127,12 +127,12 @@ discard block |
||
| 127 | 127 | 'attribute' => 'email', // foreign key attribute that is shown to user |
| 128 | 128 | 'model' => 'App\Models\User', // foreign key model |
| 129 | 129 | 'orderable' => true, |
| 130 | - 'orderLogic' => function ($query, $column, $columnDirection) { |
|
| 130 | + 'orderLogic' => function($query, $column, $columnDirection) { |
|
| 131 | 131 | return $query->leftJoin('users', 'users.id', '=', 'students.id') |
| 132 | 132 | ->orderBy('users.email', $columnDirection)->select('students.*'); |
| 133 | 133 | }, |
| 134 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 135 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 134 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 135 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 136 | 136 | $q->where('email', 'like', '%'.$searchTerm.'%'); |
| 137 | 137 | }); |
| 138 | 138 | }, |
@@ -160,32 +160,32 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | ]); |
| 162 | 162 | |
| 163 | - CRUD::addFilter([ // select2 filter |
|
| 163 | + CRUD::addFilter([// select2 filter |
|
| 164 | 164 | 'name' => 'enrolled', |
| 165 | 165 | 'type' => 'select2', |
| 166 | 166 | 'label'=> __('Is Enrolled in'), |
| 167 | - ], function () { |
|
| 167 | + ], function() { |
|
| 168 | 168 | return Period::all()->pluck('name', 'id')->toArray(); |
| 169 | - }, function ($value) { // if the filter is active |
|
| 170 | - $this->crud->query = $this->crud->query->whereHas('enrollments', function ($query) use ($value) { |
|
| 171 | - return $query->whereHas('course', function ($q) use ($value) { |
|
| 169 | + }, function($value) { // if the filter is active |
|
| 170 | + $this->crud->query = $this->crud->query->whereHas('enrollments', function($query) use ($value) { |
|
| 171 | + return $query->whereHas('course', function($q) use ($value) { |
|
| 172 | 172 | $q->where('period_id', $value); |
| 173 | 173 | }); |
| 174 | 174 | }); |
| 175 | 175 | }, |
| 176 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 176 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 177 | 177 | }); |
| 178 | 178 | |
| 179 | - CRUD::addFilter([ // select2_multiple filter |
|
| 179 | + CRUD::addFilter([// select2_multiple filter |
|
| 180 | 180 | 'name' => 'notenrolled', |
| 181 | 181 | 'type' => 'select2_multiple', |
| 182 | 182 | 'label'=> __('Is Not Enrolled in'), |
| 183 | - ], function () { // the options that show up in the select2 |
|
| 183 | + ], function() { // the options that show up in the select2 |
|
| 184 | 184 | return Period::all()->pluck('name', 'id')->toArray(); |
| 185 | - }, function ($values) { // if the filter is active |
|
| 185 | + }, function($values) { // if the filter is active |
|
| 186 | 186 | foreach (json_decode($values) as $value) { |
| 187 | - $this->crud->query = $this->crud->query->whereDoesntHave('enrollments', function ($query) use ($value) { |
|
| 188 | - return $query->whereHas('course', function ($q) use ($value) { |
|
| 187 | + $this->crud->query = $this->crud->query->whereDoesntHave('enrollments', function($query) use ($value) { |
|
| 188 | + return $query->whereHas('course', function($q) use ($value) { |
|
| 189 | 189 | $q->where('period_id', $value); |
| 190 | 190 | }); |
| 191 | 191 | }); |
@@ -197,9 +197,9 @@ discard block |
||
| 197 | 197 | 'name' => 'institution_id', |
| 198 | 198 | 'type' => 'select2', |
| 199 | 199 | 'label' => __('Institution'), |
| 200 | - ], function () { |
|
| 200 | + ], function() { |
|
| 201 | 201 | return Institution::all()->pluck('name', 'id')->toArray(); |
| 202 | - }, function ($value) { // if the filter is active |
|
| 202 | + }, function($value) { // if the filter is active |
|
| 203 | 203 | $this->crud->addClause('where', 'institution_id', $value); |
| 204 | 204 | }); |
| 205 | 205 | |
@@ -207,9 +207,9 @@ discard block |
||
| 207 | 207 | 'name' => 'status_type_id', |
| 208 | 208 | 'type' => 'select2', |
| 209 | 209 | 'label' => __('Lead Status'), |
| 210 | - ], function () { |
|
| 210 | + ], function() { |
|
| 211 | 211 | return LeadType::all()->pluck('name', 'id')->toArray(); |
| 212 | - }, function ($value) { |
|
| 212 | + }, function($value) { |
|
| 213 | 213 | $this->crud->addClause('computedLeadType', $value); |
| 214 | 214 | }); |
| 215 | 215 | } |
@@ -300,11 +300,11 @@ discard block |
||
| 300 | 300 | $username_parts = array_filter(explode(" ", strtolower($fullName))); |
| 301 | 301 | $username_parts = array_slice($username_parts, -2); |
| 302 | 302 | |
| 303 | - $part1 = (!empty($username_parts[0]))?substr($username_parts[0], 0,3):""; |
|
| 304 | - $part2 = (!empty($username_parts[1]))?substr($username_parts[1], 0,8):""; |
|
| 303 | + $part1 = (!empty($username_parts[0])) ?substr($username_parts[0], 0, 3) : ""; |
|
| 304 | + $part2 = (!empty($username_parts[1])) ?substr($username_parts[1], 0, 8) : ""; |
|
| 305 | 305 | $part3 = rand(999, 9999); |
| 306 | 306 | |
| 307 | - $username = $part1. $part2. $part3; //str_shuffle to randomly shuffle all characters |
|
| 307 | + $username = $part1.$part2.$part3; //str_shuffle to randomly shuffle all characters |
|
| 308 | 308 | |
| 309 | 309 | return $username; |
| 310 | 310 | } |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | $username = $request->email; |
| 323 | 323 | } |
| 324 | 324 | else { |
| 325 | - $username = $this->generateUsername($request->firstname . ' ' . $request->lastname); |
|
| 325 | + $username = $this->generateUsername($request->firstname.' '.$request->lastname); |
|
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | // update the user info |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | { |
| 392 | 392 | $student = Student::findOrFail($student); |
| 393 | 393 | |
| 394 | - if (! backpack_user()->isTeacher() && ! backpack_user()->can('enrollments.view')) { |
|
| 394 | + if (!backpack_user()->isTeacher() && !backpack_user()->can('enrollments.view')) { |
|
| 395 | 395 | abort(403); |
| 396 | 396 | } |
| 397 | 397 | |
@@ -164,8 +164,7 @@ |
||
| 164 | 164 | if (User::where('email', $request->email)->count() === 0) |
| 165 | 165 | { |
| 166 | 166 | $username = $request->email; |
| 167 | - } |
|
| 168 | - else { |
|
| 167 | + } else { |
|
| 169 | 168 | $username = $this->generateUsername($request->firstname . ' ' . $request->lastname); |
| 170 | 169 | } |
| 171 | 170 | |
@@ -75,20 +75,20 @@ |
||
| 75 | 75 | }, function ($value) { // if the filter is active |
| 76 | 76 | CRUD::addClause('where', 'teacher_id', $value); |
| 77 | 77 | }, |
| 78 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 79 | - }); |
|
| 78 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 79 | + }); |
|
| 80 | 80 | |
| 81 | 81 | CRUD::addFilter([ // daterange filter |
| 82 | 82 | 'type' => 'date_range', |
| 83 | 83 | 'name' => 'from_to', |
| 84 | 84 | 'label'=> __('Date range'), |
| 85 | 85 | ], |
| 86 | - false, |
|
| 87 | - function ($value) { // if the filter is active, apply these constraints |
|
| 88 | - $dates = json_decode($value); |
|
| 89 | - CRUD::addClause('where', 'date', '>=', $dates->from); |
|
| 90 | - CRUD::addClause('where', 'date', '<=', $dates->to.' 23:59:59'); |
|
| 91 | - }); |
|
| 86 | + false, |
|
| 87 | + function ($value) { // if the filter is active, apply these constraints |
|
| 88 | + $dates = json_decode($value); |
|
| 89 | + CRUD::addClause('where', 'date', '>=', $dates->from); |
|
| 90 | + CRUD::addClause('where', 'date', '<=', $dates->to.' 23:59:59'); |
|
| 91 | + }); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | protected function setupCreateOperation() |
@@ -72,25 +72,25 @@ discard block |
||
| 72 | 72 | ], |
| 73 | 73 | ]); |
| 74 | 74 | |
| 75 | - CRUD::addFilter([ // select2 filter |
|
| 75 | + CRUD::addFilter([// select2 filter |
|
| 76 | 76 | 'name' => 'teacher_id', |
| 77 | 77 | 'type' => 'select2', |
| 78 | 78 | 'label'=> __('Teacher'), |
| 79 | - ], function () { |
|
| 79 | + ], function() { |
|
| 80 | 80 | return Teacher::all()->pluck('name', 'id')->toArray(); |
| 81 | - }, function ($value) { // if the filter is active |
|
| 81 | + }, function($value) { // if the filter is active |
|
| 82 | 82 | CRUD::addClause('where', 'teacher_id', $value); |
| 83 | 83 | }, |
| 84 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 84 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 85 | 85 | }); |
| 86 | 86 | |
| 87 | - CRUD::addFilter([ // daterange filter |
|
| 87 | + CRUD::addFilter([// daterange filter |
|
| 88 | 88 | 'type' => 'date_range', |
| 89 | 89 | 'name' => 'from_to', |
| 90 | 90 | 'label'=> __('Date range'), |
| 91 | 91 | ], |
| 92 | 92 | false, |
| 93 | - function ($value) { // if the filter is active, apply these constraints |
|
| 93 | + function($value) { // if the filter is active, apply these constraints |
|
| 94 | 94 | $dates = json_decode($value); |
| 95 | 95 | CRUD::addClause('where', 'date', '>=', $dates->from); |
| 96 | 96 | CRUD::addClause('where', 'date', '<=', $dates->to.' 23:59:59'); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | 'model' => LeaveType::class, // foreign key model |
| 123 | 123 | ], |
| 124 | 124 | |
| 125 | - [ // date_range |
|
| 125 | + [// date_range |
|
| 126 | 126 | 'name' => ['start_date', 'end_date'], // db columns for start_date & end_date |
| 127 | 127 | 'label' => 'Event Date Range', |
| 128 | 128 | 'type' => 'date_range', |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | 'model' => LeaveType::class, // foreign key model |
| 167 | 167 | ], |
| 168 | 168 | |
| 169 | - [ // datepicker |
|
| 169 | + [// datepicker |
|
| 170 | 170 | 'name' => 'date', |
| 171 | 171 | 'label' => 'Event Date', |
| 172 | 172 | 'type' => 'date', |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | protected function mapWebRoutes() |
| 53 | 53 | { |
| 54 | 54 | Route::middleware('web') |
| 55 | - ->namespace($this->namespace) |
|
| 56 | - ->group(base_path('routes/web.php')); |
|
| 55 | + ->namespace($this->namespace) |
|
| 56 | + ->group(base_path('routes/web.php')); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | protected function mapApiRoutes() |
| 67 | 67 | { |
| 68 | 68 | Route::prefix('api') |
| 69 | - ->middleware('api') |
|
| 70 | - ->namespace($this->namespace) |
|
| 71 | - ->group(base_path('routes/api.php')); |
|
| 69 | + ->middleware('api') |
|
| 70 | + ->namespace($this->namespace) |
|
| 71 | + ->group(base_path('routes/api.php')); |
|
| 72 | 72 | } |
| 73 | 73 | } |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | View::composer( |
| 40 | - ['partials.create_new_contact', 'students.edit-contact'], function ($view) { |
|
| 40 | + ['partials.create_new_contact', 'students.edit-contact'], function($view) { |
|
| 41 | 41 | $view->with('contact_types', ContactRelationship::all()); |
| 42 | 42 | }); |
| 43 | 43 | } |
@@ -30,8 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | if ($firstPeriod) { |
| 32 | 32 | $periods = Period::where('id', '>=', $firstPeriod->id)->get(); |
| 33 | - } |
|
| 34 | - else { |
|
| 33 | + } else { |
|
| 35 | 34 | $periods = Period::all(); |
| 36 | 35 | } |
| 37 | 36 | |
@@ -92,10 +92,10 @@ discard block |
||
| 92 | 92 | 'name' => 'action', |
| 93 | 93 | 'label'=> 'Action', |
| 94 | 94 | ], |
| 95 | - false, |
|
| 96 | - function () { // if the filter is active |
|
| 97 | - CRUD::addClause('where', 'action', true); |
|
| 98 | - }); |
|
| 95 | + false, |
|
| 96 | + function () { // if the filter is active |
|
| 97 | + CRUD::addClause('where', 'action', true); |
|
| 98 | + }); |
|
| 99 | 99 | |
| 100 | 100 | CRUD::addFilter([ // dropdown filter |
| 101 | 101 | 'name' => 'type', |
@@ -109,10 +109,10 @@ discard block |
||
| 109 | 109 | ], function ($value) { // if the filter is active |
| 110 | 110 | CRUD::addClause('where', 'commentable_type', '=', $value); |
| 111 | 111 | }, |
| 112 | - function () { // if the filter is not active |
|
| 113 | - CRUD::addClause('where', 'commentable_type', '=', Student::class); |
|
| 114 | - $this->crud->getRequest()->request->add(['commentable_type' => Student::class]); // to make the filter look active |
|
| 115 | - }); |
|
| 112 | + function () { // if the filter is not active |
|
| 113 | + CRUD::addClause('where', 'commentable_type', '=', Student::class); |
|
| 114 | + $this->crud->getRequest()->request->add(['commentable_type' => Student::class]); // to make the filter look active |
|
| 115 | + }); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | public function setupUpdateOperation() |
@@ -86,17 +86,17 @@ discard block |
||
| 86 | 86 | ], |
| 87 | 87 | ]); |
| 88 | 88 | |
| 89 | - CRUD::addFilter([ // simple filter |
|
| 89 | + CRUD::addFilter([// 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 | - CRUD::addFilter([ // dropdown filter |
|
| 99 | + CRUD::addFilter([// dropdown filter |
|
| 100 | 100 | 'name' => 'type', |
| 101 | 101 | 'type' => 'dropdown', |
| 102 | 102 | 'label'=> 'Type', |
@@ -107,10 +107,10 @@ discard block |
||
| 107 | 107 | Invoice::class => 'Invoice', |
| 108 | 108 | Result::class => 'Result', |
| 109 | 109 | |
| 110 | - ], function ($value) { // if the filter is active |
|
| 110 | + ], function($value) { // if the filter is active |
|
| 111 | 111 | CRUD::addClause('where', 'commentable_type', '=', $value); |
| 112 | 112 | }, |
| 113 | - function () { // if the filter is not active |
|
| 113 | + function() { // if the filter is not active |
|
| 114 | 114 | CRUD::addClause('where', 'commentable_type', '=', Student::class); |
| 115 | 115 | $this->crud->getRequest()->request->add(['commentable_type' => Student::class]); // to make the filter look active |
| 116 | 116 | }); |
@@ -112,13 +112,13 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | ]); |
| 114 | 114 | |
| 115 | - CRUD::addFilter([ // daterange filter |
|
| 115 | + CRUD::addFilter([// 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); |
| 123 | 123 | |
| 124 | 124 | if ($dates->from) { |
@@ -135,10 +135,10 @@ discard block |
||
| 135 | 135 | 'label'=> __('Events with no course'), |
| 136 | 136 | ], |
| 137 | 137 | false, |
| 138 | - function ($value) { // if the filter is active, apply these constraints |
|
| 138 | + function($value) { // if the filter is active, apply these constraints |
|
| 139 | 139 | $this->crud->query->where('course_id', null); |
| 140 | 140 | }, |
| 141 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 141 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 142 | 142 | }); |
| 143 | 143 | |
| 144 | 144 | CRUD::addFilter([ |
@@ -147,20 +147,20 @@ discard block |
||
| 147 | 147 | 'label'=> __('Events with no teacher'), |
| 148 | 148 | ], |
| 149 | 149 | false, |
| 150 | - function ($value) { // if the filter is active, apply these constraints |
|
| 150 | + function($value) { // if the filter is active, apply these constraints |
|
| 151 | 151 | $this->crud->query->where('teacher_id', null); |
| 152 | 152 | }); |
| 153 | 153 | |
| 154 | - CRUD::addFilter([ // select2 filter |
|
| 154 | + CRUD::addFilter([// select2 filter |
|
| 155 | 155 | 'name' => 'teacher_id', |
| 156 | 156 | 'type' => 'select2', |
| 157 | 157 | 'label'=> __('Teacher'), |
| 158 | - ], function () { |
|
| 158 | + ], function() { |
|
| 159 | 159 | return Teacher::all()->pluck('name', 'id')->toArray(); |
| 160 | - }, function ($value) { // if the filter is active |
|
| 160 | + }, function($value) { // if the filter is active |
|
| 161 | 161 | CRUD::addClause('where', 'teacher_id', $value); |
| 162 | 162 | }, |
| 163 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 163 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 164 | 164 | }); |
| 165 | 165 | } |
| 166 | 166 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | 'entity' => 'teacher', // the method that defines the relationship in your Model |
| 84 | 84 | 'attribute' => 'name', // foreign key attribute that is shown to user |
| 85 | 85 | 'model' => Teacher::class, // foreign key model |
| 86 | - 'searchLogic' => false, |
|
| 86 | + 'searchLogic' => false, |
|
| 87 | 87 | ], |
| 88 | 88 | |
| 89 | 89 | [ |
@@ -117,39 +117,39 @@ discard block |
||
| 117 | 117 | 'name' => 'from_to', |
| 118 | 118 | 'label'=> __('Date range'), |
| 119 | 119 | ], |
| 120 | - false, |
|
| 121 | - function ($value) { // if the filter is active, apply these constraints |
|
| 122 | - $dates = json_decode($value); |
|
| 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 | - }); |
|
| 120 | + false, |
|
| 121 | + function ($value) { // if the filter is active, apply these constraints |
|
| 122 | + $dates = json_decode($value); |
|
| 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 | CRUD::addFilter([ |
| 133 | 133 | 'type' => 'simple', |
| 134 | 134 | 'name' => 'orphan', |
| 135 | 135 | 'label'=> __('Events with no course'), |
| 136 | 136 | ], |
| 137 | - false, |
|
| 138 | - function ($value) { // if the filter is active, apply these constraints |
|
| 139 | - $this->crud->query->where('course_id', null); |
|
| 140 | - }, |
|
| 141 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 142 | - }); |
|
| 137 | + false, |
|
| 138 | + function ($value) { // if the filter is active, apply these constraints |
|
| 139 | + $this->crud->query->where('course_id', null); |
|
| 140 | + }, |
|
| 141 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 142 | + }); |
|
| 143 | 143 | |
| 144 | 144 | CRUD::addFilter([ |
| 145 | 145 | 'type' => 'simple', |
| 146 | 146 | 'name' => 'unassigned', |
| 147 | 147 | 'label'=> __('Events with no teacher'), |
| 148 | 148 | ], |
| 149 | - false, |
|
| 150 | - function ($value) { // if the filter is active, apply these constraints |
|
| 151 | - $this->crud->query->where('teacher_id', null); |
|
| 152 | - }); |
|
| 149 | + false, |
|
| 150 | + function ($value) { // if the filter is active, apply these constraints |
|
| 151 | + $this->crud->query->where('teacher_id', null); |
|
| 152 | + }); |
|
| 153 | 153 | |
| 154 | 154 | CRUD::addFilter([ // select2 filter |
| 155 | 155 | 'name' => 'teacher_id', |
@@ -160,8 +160,8 @@ discard block |
||
| 160 | 160 | }, function ($value) { // if the filter is active |
| 161 | 161 | CRUD::addClause('where', 'teacher_id', $value); |
| 162 | 162 | }, |
| 163 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 164 | - }); |
|
| 163 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 164 | + }); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | public function store(Request $request) |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | |
| 42 | 42 | public function search() |
| 43 | 43 | { |
| 44 | - return QueryBuilder::for(Course::class)->where('campus_id', 1) |
|
| 44 | + return QueryBuilder::for (Course::class)->where('campus_id', 1) |
|
| 45 | 45 | ->with('room')->withCount('events')->withCount('children')->withCount('enrollments') |
| 46 | 46 | ->allowedFilters([ |
| 47 | 47 | 'name', |
@@ -39,7 +39,8 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | public function search() |
| 41 | 41 | { |
| 42 | - return QueryBuilder::for(Course::class)->where('campus_id', 1) |
|
| 42 | + return QueryBuilder::for(Course::class) { |
|
| 43 | + ->where('campus_id', 1) |
|
| 43 | 44 | ->with('room')->withCount('events')->withCount('children')->withCount('enrollments') |
| 44 | 45 | ->allowedFilters([ |
| 45 | 46 | 'name', |
@@ -49,6 +50,7 @@ discard block |
||
| 49 | 50 | AllowedFilter::exact('teacher_id'), |
| 50 | 51 | ]) |
| 51 | 52 | ->get(); |
| 53 | + } |
|
| 52 | 54 | } |
| 53 | 55 | |
| 54 | 56 | public function redirectToUserPreferredView() |