@@ -54,7 +54,7 @@ |
||
| 54 | 54 | CRUD::addFields([ |
| 55 | 55 | ['name' => 'name', 'label' => 'Name', 'type' => 'text'], |
| 56 | 56 | ['name' => 'total', 'label' => 'Total', 'type' => 'text'], |
| 57 | - [ // Select |
|
| 57 | + [// Select |
|
| 58 | 58 | 'label' => 'Category', |
| 59 | 59 | 'type' => 'select', |
| 60 | 60 | 'name' => 'grade_type_category_id', // the db column for the foreign key |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | $this->crud->allowAccess('showstudentphotoroster'); |
| 33 | 33 | $this->crud->setOperationSetting('setFromDb', true); |
| 34 | 34 | |
| 35 | - $this->crud->operation('showstudentphotoroster', function () { |
|
| 35 | + $this->crud->operation('showstudentphotoroster', function() { |
|
| 36 | 36 | $this->crud->loadDefaultOperationSettingsFromConfig(); |
| 37 | 37 | }); |
| 38 | 38 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | 'label' => trans('backpack::permissionmanager.email'), |
| 42 | 42 | 'type' => 'email', |
| 43 | 43 | ], |
| 44 | - [ // n-n relationship (with pivot table) |
|
| 44 | + [// n-n relationship (with pivot table) |
|
| 45 | 45 | 'label' => trans('backpack::permissionmanager.roles'), // Table column heading |
| 46 | 46 | 'type' => 'select_multiple', |
| 47 | 47 | 'name' => 'roles', // the method that defines the relationship in your Model |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | 'label' => trans('backpack::permissionmanager.role'), |
| 61 | 61 | ], |
| 62 | 62 | config('permission.models.role')::all()->pluck('name', 'id')->toArray(), |
| 63 | - function ($value) { // if the filter is active |
|
| 64 | - $this->crud->addClause('whereHas', 'roles', function ($query) use ($value) { |
|
| 63 | + function($value) { // if the filter is active |
|
| 64 | + $this->crud->addClause('whereHas', 'roles', function($query) use ($value) { |
|
| 65 | 65 | $query->where('role_id', '=', $value); |
| 66 | 66 | }); |
| 67 | 67 | } |
@@ -114,12 +114,12 @@ discard block |
||
| 114 | 114 | protected function addFields() |
| 115 | 115 | { |
| 116 | 116 | $this->crud->addFields([ |
| 117 | - [ // Select2 |
|
| 117 | + [// Select2 |
|
| 118 | 118 | 'label' => trans('firstname'), |
| 119 | 119 | 'type' => 'text', |
| 120 | 120 | 'name' => 'firstname', |
| 121 | 121 | ], |
| 122 | - [ // Select2 |
|
| 122 | + [// Select2 |
|
| 123 | 123 | 'label' => trans('lastname'), |
| 124 | 124 | 'type' => 'text', |
| 125 | 125 | 'name' => 'lastname', |
@@ -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', |
@@ -82,12 +82,12 @@ discard block |
||
| 82 | 82 | 'attribute' => 'lastname', // foreign key attribute that is shown to user |
| 83 | 83 | 'model' => 'App\Models\User', // foreign key model |
| 84 | 84 | 'orderable' => true, |
| 85 | - 'orderLogic' => function ($query, $column, $columnDirection) { |
|
| 85 | + 'orderLogic' => function($query, $column, $columnDirection) { |
|
| 86 | 86 | return $query->leftJoin('users', 'users.id', '=', 'students.id') |
| 87 | 87 | ->orderBy('users.lastname', $columnDirection)->select('students.*'); |
| 88 | 88 | }, |
| 89 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 90 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 89 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 90 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 91 | 91 | $q->where('lastname', 'like', '%'.$searchTerm.'%'); |
| 92 | 92 | }); |
| 93 | 93 | }, |
@@ -102,12 +102,12 @@ discard block |
||
| 102 | 102 | 'attribute' => 'firstname', // foreign key attribute that is shown to user |
| 103 | 103 | 'model' => 'App\Models\User', // foreign key model |
| 104 | 104 | 'orderable' => true, |
| 105 | - 'orderLogic' => function ($query, $column, $columnDirection) { |
|
| 105 | + 'orderLogic' => function($query, $column, $columnDirection) { |
|
| 106 | 106 | return $query->leftJoin('users', 'users.id', '=', 'students.id') |
| 107 | 107 | ->orderBy('users.firstname', $columnDirection)->select('students.*'); |
| 108 | 108 | }, |
| 109 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 110 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 109 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 110 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 111 | 111 | $q->where('firstname', 'like', '%'.$searchTerm.'%'); |
| 112 | 112 | }); |
| 113 | 113 | }, |
@@ -122,12 +122,12 @@ discard block |
||
| 122 | 122 | 'attribute' => 'email', // foreign key attribute that is shown to user |
| 123 | 123 | 'model' => 'App\Models\User', // foreign key model |
| 124 | 124 | 'orderable' => true, |
| 125 | - 'orderLogic' => function ($query, $column, $columnDirection) { |
|
| 125 | + 'orderLogic' => function($query, $column, $columnDirection) { |
|
| 126 | 126 | return $query->leftJoin('users', 'users.id', '=', 'students.id') |
| 127 | 127 | ->orderBy('users.email', $columnDirection)->select('students.*'); |
| 128 | 128 | }, |
| 129 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 130 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 129 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 130 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 131 | 131 | $q->where('email', 'like', '%'.$searchTerm.'%'); |
| 132 | 132 | }); |
| 133 | 133 | }, |
@@ -145,32 +145,32 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | ]); |
| 147 | 147 | |
| 148 | - CRUD::addFilter([ // select2 filter |
|
| 148 | + CRUD::addFilter([// select2 filter |
|
| 149 | 149 | 'name' => 'enrolled', |
| 150 | 150 | 'type' => 'select2', |
| 151 | 151 | 'label'=> __('Is Enrolled in'), |
| 152 | - ], function () { |
|
| 152 | + ], function() { |
|
| 153 | 153 | return Period::all()->pluck('name', 'id')->toArray(); |
| 154 | - }, function ($value) { // if the filter is active |
|
| 155 | - $this->crud->query = $this->crud->query->whereHas('enrollments', function ($query) use ($value) { |
|
| 156 | - return $query->whereHas('course', function ($q) use ($value) { |
|
| 154 | + }, function($value) { // if the filter is active |
|
| 155 | + $this->crud->query = $this->crud->query->whereHas('enrollments', function($query) use ($value) { |
|
| 156 | + return $query->whereHas('course', function($q) use ($value) { |
|
| 157 | 157 | $q->where('period_id', $value); |
| 158 | 158 | }); |
| 159 | 159 | }); |
| 160 | 160 | }, |
| 161 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 161 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 162 | 162 | }); |
| 163 | 163 | |
| 164 | - CRUD::addFilter([ // select2_multiple filter |
|
| 164 | + CRUD::addFilter([// select2_multiple filter |
|
| 165 | 165 | 'name' => 'notenrolled', |
| 166 | 166 | 'type' => 'select2_multiple', |
| 167 | 167 | 'label'=> __('Is Not Enrolled in'), |
| 168 | - ], function () { // the options that show up in the select2 |
|
| 168 | + ], function() { // the options that show up in the select2 |
|
| 169 | 169 | return Period::all()->pluck('name', 'id')->toArray(); |
| 170 | - }, function ($values) { // if the filter is active |
|
| 170 | + }, function($values) { // if the filter is active |
|
| 171 | 171 | foreach (json_decode($values) as $key => $value) { |
| 172 | - $this->crud->query = $this->crud->query->whereDoesntHave('enrollments', function ($query) use ($value) { |
|
| 173 | - return $query->whereHas('course', function ($q) use ($value) { |
|
| 172 | + $this->crud->query = $this->crud->query->whereDoesntHave('enrollments', function($query) use ($value) { |
|
| 173 | + return $query->whereHas('course', function($q) use ($value) { |
|
| 174 | 174 | $q->where('period_id', $value); |
| 175 | 175 | }); |
| 176 | 176 | }); |
@@ -182,9 +182,9 @@ discard block |
||
| 182 | 182 | 'name' => 'institution_id', |
| 183 | 183 | 'type' => 'select2', |
| 184 | 184 | 'label' => __('Institution'), |
| 185 | - ], function () { |
|
| 185 | + ], function() { |
|
| 186 | 186 | return Institution::all()->pluck('name', 'id')->toArray(); |
| 187 | - }, function ($value) { // if the filter is active |
|
| 187 | + }, function($value) { // if the filter is active |
|
| 188 | 188 | $this->crud->addClause('where', 'institution_id', $value); |
| 189 | 189 | }); |
| 190 | 190 | |
@@ -192,9 +192,9 @@ discard block |
||
| 192 | 192 | 'name' => 'status_type_id', |
| 193 | 193 | 'type' => 'select2', |
| 194 | 194 | 'label' => __('Lead Status'), |
| 195 | - ], function () { |
|
| 195 | + ], function() { |
|
| 196 | 196 | return LeadType::all()->pluck('name', 'id')->toArray(); |
| 197 | - }, function ($value) { |
|
| 197 | + }, function($value) { |
|
| 198 | 198 | $this->crud->addClause('computedLeadType', $value); |
| 199 | 199 | }); |
| 200 | 200 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | { |
| 204 | 204 | $student = Student::findOrFail($student); |
| 205 | 205 | |
| 206 | - if (! backpack_user()->isTeacher() && ! backpack_user()->can('enrollments.view')) { |
|
| 206 | + if (!backpack_user()->isTeacher() && !backpack_user()->can('enrollments.view')) { |
|
| 207 | 207 | abort(403); |
| 208 | 208 | } |
| 209 | 209 | |
@@ -29,10 +29,10 @@ |
||
| 29 | 29 | $this->crud->replaceSaveActions( |
| 30 | 30 | [ |
| 31 | 31 | 'name' => __('Save and go back'), |
| 32 | - 'visible' => function ($crud) { |
|
| 32 | + 'visible' => function($crud) { |
|
| 33 | 33 | return true; |
| 34 | 34 | }, |
| 35 | - 'redirect' => function ($crud, $request, $itemId) { |
|
| 35 | + 'redirect' => function($crud, $request, $itemId) { |
|
| 36 | 36 | $enrollment_id = Payment::find($itemId)->enrollment_id; |
| 37 | 37 | |
| 38 | 38 | return route('enrollment.show', ['id' => $enrollment_id]); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $q->where('firstname', 'like', '%'.$searchTerm.'%') |
| 53 | 53 | ->orWhere('lastname', 'like', '%'.$searchTerm.'%') |
| 54 | 54 | ->orWhere('email', 'like', '%'.$searchTerm.'%') |
| 55 | - ->orWhere('idnumber', 'like', '%'.$searchTerm.'%'); |
|
| 55 | + ->orWhere('idnumber', 'like', '%'.$searchTerm.'%'); |
|
| 56 | 56 | }); |
| 57 | 57 | }); |
| 58 | 58 | }, |
@@ -86,20 +86,20 @@ discard block |
||
| 86 | 86 | 'name' => 'noresult', |
| 87 | 87 | 'label'=> __('No Result'), |
| 88 | 88 | ], |
| 89 | - false, |
|
| 90 | - function () { |
|
| 91 | - CRUD::addClause('noResult'); |
|
| 92 | - }); |
|
| 89 | + false, |
|
| 90 | + function () { |
|
| 91 | + CRUD::addClause('noResult'); |
|
| 92 | + }); |
|
| 93 | 93 | |
| 94 | 94 | CRUD::addFilter([ |
| 95 | 95 | 'type' => 'simple', |
| 96 | 96 | 'name' => 'hideparents', |
| 97 | 97 | 'label'=> __('Hide Parents'), |
| 98 | 98 | ], |
| 99 | - false, |
|
| 100 | - function () { |
|
| 101 | - CRUD::addClause('real'); |
|
| 102 | - }); |
|
| 99 | + false, |
|
| 100 | + function () { |
|
| 101 | + CRUD::addClause('real'); |
|
| 102 | + }); |
|
| 103 | 103 | |
| 104 | 104 | CRUD::addFilter([ |
| 105 | 105 | 'name' => 'period_id', |
@@ -46,9 +46,9 @@ discard block |
||
| 46 | 46 | 'type' => 'select', |
| 47 | 47 | 'entity' => 'student', // the method that defines the relationship in your Model |
| 48 | 48 | 'attribute' => 'name', // foreign key attribute that is shown to user |
| 49 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 50 | - $query->orWhereHas('student', function ($q) use ($searchTerm) { |
|
| 51 | - $q->WhereHas('user', function ($q) use ($searchTerm) { |
|
| 49 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 50 | + $query->orWhereHas('student', function($q) use ($searchTerm) { |
|
| 51 | + $q->WhereHas('user', function($q) use ($searchTerm) { |
|
| 52 | 52 | $q->where('firstname', 'like', '%'.$searchTerm.'%') |
| 53 | 53 | ->orWhere('lastname', 'like', '%'.$searchTerm.'%') |
| 54 | 54 | ->orWhere('email', 'like', '%'.$searchTerm.'%') |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | 'label'=> __('No Result'), |
| 88 | 88 | ], |
| 89 | 89 | false, |
| 90 | - function () { |
|
| 90 | + function() { |
|
| 91 | 91 | CRUD::addClause('noResult'); |
| 92 | 92 | }); |
| 93 | 93 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | 'label'=> __('Hide Parents'), |
| 98 | 98 | ], |
| 99 | 99 | false, |
| 100 | - function () { |
|
| 100 | + function() { |
|
| 101 | 101 | CRUD::addClause('real'); |
| 102 | 102 | }); |
| 103 | 103 | |
@@ -105,20 +105,20 @@ discard block |
||
| 105 | 105 | 'name' => 'period_id', |
| 106 | 106 | 'type' => 'select2', |
| 107 | 107 | 'label'=> __('Period'), |
| 108 | - ], function () { |
|
| 108 | + ], function() { |
|
| 109 | 109 | return Period::all()->pluck('name', 'id')->toArray(); |
| 110 | - }, function ($value) { // if the filter is active |
|
| 110 | + }, function($value) { // if the filter is active |
|
| 111 | 111 | CRUD::addClause('period', $value); |
| 112 | 112 | }); |
| 113 | 113 | |
| 114 | - CRUD::addFilter([ // select2_multiple filter |
|
| 114 | + CRUD::addFilter([// select2_multiple filter |
|
| 115 | 115 | 'name' => 'result', |
| 116 | 116 | 'type' => 'select2', |
| 117 | 117 | 'label'=> __('Result'), |
| 118 | - ], function () { // the options that show up in the select2 |
|
| 118 | + ], function() { // the options that show up in the select2 |
|
| 119 | 119 | return ResultType::all()->pluck('name', 'id')->toArray(); |
| 120 | - }, function ($value) { // if the filter is active |
|
| 121 | - $this->crud->query = $this->crud->query->whereHas('result', function ($query) use ($value) { |
|
| 120 | + }, function($value) { // if the filter is active |
|
| 121 | + $this->crud->query = $this->crud->query->whereHas('result', function($query) use ($value) { |
|
| 122 | 122 | $query->where('result_type_id', $value); |
| 123 | 123 | }); |
| 124 | 124 | }); |
@@ -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', |
@@ -110,39 +110,39 @@ discard block |
||
| 110 | 110 | 'name' => 'from_to', |
| 111 | 111 | 'label'=> __('Date range'), |
| 112 | 112 | ], |
| 113 | - false, |
|
| 114 | - function ($value) { // if the filter is active, apply these constraints |
|
| 115 | - $dates = json_decode($value); |
|
| 116 | - |
|
| 117 | - if ($dates->from) { |
|
| 118 | - CRUD::addClause('where', 'start', '>=', $dates->from); |
|
| 119 | - } |
|
| 120 | - if ($dates->to) { |
|
| 121 | - CRUD::addClause('where', 'start', '<=', $dates->to.' 23:59:59'); |
|
| 122 | - } |
|
| 123 | - }); |
|
| 113 | + false, |
|
| 114 | + function ($value) { // if the filter is active, apply these constraints |
|
| 115 | + $dates = json_decode($value); |
|
| 116 | + |
|
| 117 | + if ($dates->from) { |
|
| 118 | + CRUD::addClause('where', 'start', '>=', $dates->from); |
|
| 119 | + } |
|
| 120 | + if ($dates->to) { |
|
| 121 | + CRUD::addClause('where', 'start', '<=', $dates->to.' 23:59:59'); |
|
| 122 | + } |
|
| 123 | + }); |
|
| 124 | 124 | |
| 125 | 125 | CRUD::addFilter([ |
| 126 | 126 | 'type' => 'simple', |
| 127 | 127 | 'name' => 'orphan', |
| 128 | 128 | 'label'=> __('Events with no course'), |
| 129 | 129 | ], |
| 130 | - false, |
|
| 131 | - function ($value) { // if the filter is active, apply these constraints |
|
| 132 | - $this->crud->query->where('course_id', null); |
|
| 133 | - }, |
|
| 134 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 135 | - }); |
|
| 130 | + false, |
|
| 131 | + function ($value) { // if the filter is active, apply these constraints |
|
| 132 | + $this->crud->query->where('course_id', null); |
|
| 133 | + }, |
|
| 134 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 135 | + }); |
|
| 136 | 136 | |
| 137 | 137 | CRUD::addFilter([ |
| 138 | 138 | 'type' => 'simple', |
| 139 | 139 | 'name' => 'unassigned', |
| 140 | 140 | 'label'=> __('Events with no teacher'), |
| 141 | 141 | ], |
| 142 | - false, |
|
| 143 | - function ($value) { // if the filter is active, apply these constraints |
|
| 144 | - $this->crud->query->where('teacher_id', null); |
|
| 145 | - }); |
|
| 142 | + false, |
|
| 143 | + function ($value) { // if the filter is active, apply these constraints |
|
| 144 | + $this->crud->query->where('teacher_id', null); |
|
| 145 | + }); |
|
| 146 | 146 | |
| 147 | 147 | CRUD::addFilter([ // select2 filter |
| 148 | 148 | 'name' => 'teacher_id', |
@@ -153,8 +153,8 @@ discard block |
||
| 153 | 153 | }, function ($value) { // if the filter is active |
| 154 | 154 | CRUD::addClause('where', 'teacher_id', $value); |
| 155 | 155 | }, |
| 156 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 157 | - }); |
|
| 156 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 157 | + }); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | public function store(Request $request) |
@@ -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 | |
@@ -136,11 +136,11 @@ |
||
| 136 | 136 | ], function () { |
| 137 | 137 | return EnrollmentStatusType::all()->pluck('name', 'id')->toArray(); |
| 138 | 138 | }, |
| 139 | - function ($values) { // if the filter is active |
|
| 140 | - foreach (json_decode($values) as $key => $value) { |
|
| 141 | - CRUD::addClause('orWhere', 'status_id', $value); |
|
| 142 | - } |
|
| 143 | - }); |
|
| 139 | + function ($values) { // if the filter is active |
|
| 140 | + foreach (json_decode($values) as $key => $value) { |
|
| 141 | + CRUD::addClause('orWhere', 'status_id', $value); |
|
| 142 | + } |
|
| 143 | + }); |
|
| 144 | 144 | |
| 145 | 145 | CRUD::addFilter([ |
| 146 | 146 | 'name' => 'period_id', |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | 'name' => 'user.lastname', |
| 70 | 70 | 'label' => __('Last Name'), |
| 71 | 71 | 'type' => 'text', |
| 72 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 73 | - $query->orWhereHas('student', function ($q) use ($searchTerm) { |
|
| 74 | - $q->whereHas('user', function ($q) use ($searchTerm) { |
|
| 72 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 73 | + $query->orWhereHas('student', function($q) use ($searchTerm) { |
|
| 74 | + $q->whereHas('user', function($q) use ($searchTerm) { |
|
| 75 | 75 | $q->where('lastname', 'like', '%'.$searchTerm.'%'); |
| 76 | 76 | }); |
| 77 | 77 | }); |
@@ -82,9 +82,9 @@ discard block |
||
| 82 | 82 | 'name' => 'user.firstname', |
| 83 | 83 | 'label' => __('First Name'), |
| 84 | 84 | 'type' => 'text', |
| 85 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 86 | - $query->orWhereHas('student', function ($q) use ($searchTerm) { |
|
| 87 | - $q->whereHas('user', function ($q) use ($searchTerm) { |
|
| 85 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 86 | + $query->orWhereHas('student', function($q) use ($searchTerm) { |
|
| 87 | + $q->whereHas('user', function($q) use ($searchTerm) { |
|
| 88 | 88 | $q->where('firstname', 'like', '%'.$searchTerm.'%'); |
| 89 | 89 | }); |
| 90 | 90 | }); |
@@ -133,10 +133,10 @@ discard block |
||
| 133 | 133 | 'name' => 'status_id', |
| 134 | 134 | 'type' => 'select2_multiple', |
| 135 | 135 | 'label'=> __('Status'), |
| 136 | - ], function () { |
|
| 136 | + ], function() { |
|
| 137 | 137 | return EnrollmentStatusType::all()->pluck('name', 'id')->toArray(); |
| 138 | 138 | }, |
| 139 | - function ($values) { // if the filter is active |
|
| 139 | + function($values) { // if the filter is active |
|
| 140 | 140 | foreach (json_decode($values) as $key => $value) { |
| 141 | 141 | CRUD::addClause('orWhere', 'status_id', $value); |
| 142 | 142 | } |
@@ -146,9 +146,9 @@ discard block |
||
| 146 | 146 | 'name' => 'period_id', |
| 147 | 147 | 'type' => 'select2', |
| 148 | 148 | 'label'=> __('Period'), |
| 149 | - ], function () { |
|
| 149 | + ], function() { |
|
| 150 | 150 | return Period::all()->pluck('name', 'id')->toArray(); |
| 151 | - }, function ($value) { // if the filter is active |
|
| 151 | + }, function($value) { // if the filter is active |
|
| 152 | 152 | CRUD::addClause('period', $value); |
| 153 | 153 | }); |
| 154 | 154 | } |