@@ -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', |
@@ -44,11 +44,11 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | $permissions = backpack_user()->getAllPermissions(); |
| 46 | 46 | |
| 47 | - if (! $permissions->contains('name', 'courses.edit')) { |
|
| 47 | + if (!$permissions->contains('name', 'courses.edit')) { |
|
| 48 | 48 | CRUD::denyAccess('update'); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - if (! $permissions->contains('name', 'courses.edit')) { |
|
| 51 | + if (!$permissions->contains('name', 'courses.edit')) { |
|
| 52 | 52 | CRUD::denyAccess('create'); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | CRUD::addButtonFromView('line', 'children_badge', 'children_badge', 'beginning'); |
| 64 | 64 | |
| 65 | - if (! $permissions->contains('name', 'courses.delete')) { |
|
| 65 | + if (!$permissions->contains('name', 'courses.delete')) { |
|
| 66 | 66 | CRUD::denyAccess('delete'); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -159,52 +159,52 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | ]); |
| 161 | 161 | |
| 162 | - CRUD::addFilter([ // select2 filter |
|
| 162 | + CRUD::addFilter([// select2 filter |
|
| 163 | 163 | 'name' => 'rhythm_id', |
| 164 | 164 | 'type' => 'select2', |
| 165 | 165 | 'label'=> __('Rhythm'), |
| 166 | - ], function () { |
|
| 166 | + ], function() { |
|
| 167 | 167 | return \App\Models\Rhythm::all()->pluck('name', 'id')->toArray(); |
| 168 | - }, function ($value) { // if the filter is active |
|
| 168 | + }, function($value) { // if the filter is active |
|
| 169 | 169 | CRUD::addClause('where', 'rhythm_id', $value); |
| 170 | 170 | }, |
| 171 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 171 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 172 | 172 | }); |
| 173 | 173 | |
| 174 | - CRUD::addFilter([ // select2 filter |
|
| 174 | + CRUD::addFilter([// select2 filter |
|
| 175 | 175 | 'name' => 'teacher_id', |
| 176 | 176 | 'type' => 'select2', |
| 177 | 177 | 'label'=> __('Teacher'), |
| 178 | - ], function () { |
|
| 178 | + ], function() { |
|
| 179 | 179 | return \App\Models\Teacher::all()->pluck('name', 'id')->toArray(); |
| 180 | - }, function ($value) { // if the filter is active |
|
| 180 | + }, function($value) { // if the filter is active |
|
| 181 | 181 | CRUD::addClause('where', 'teacher_id', $value); |
| 182 | 182 | }, |
| 183 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 183 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 184 | 184 | }); |
| 185 | 185 | |
| 186 | - CRUD::addFilter([ // select2 filter |
|
| 186 | + CRUD::addFilter([// select2 filter |
|
| 187 | 187 | 'name' => 'level_id', |
| 188 | 188 | 'type' => 'select2', |
| 189 | 189 | 'label'=> __('Level'), |
| 190 | - ], function () { |
|
| 190 | + ], function() { |
|
| 191 | 191 | return \App\Models\Level::all()->pluck('name', 'id')->toArray(); |
| 192 | - }, function ($value) { // if the filter is active |
|
| 192 | + }, function($value) { // if the filter is active |
|
| 193 | 193 | CRUD::addClause('where', 'level_id', $value); |
| 194 | 194 | }, |
| 195 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 195 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 196 | 196 | }); |
| 197 | 197 | |
| 198 | - CRUD::addFilter([ // select2 filter |
|
| 198 | + CRUD::addFilter([// select2 filter |
|
| 199 | 199 | 'name' => 'period_id', |
| 200 | 200 | 'type' => 'select2', |
| 201 | 201 | 'label'=> __('Period'), |
| 202 | - ], function () { |
|
| 202 | + ], function() { |
|
| 203 | 203 | return \App\Models\Period::all()->sortByDesc('id')->pluck('name', 'id')->toArray(); |
| 204 | - }, function ($value) { // if the filter is active |
|
| 204 | + }, function($value) { // if the filter is active |
|
| 205 | 205 | CRUD::addClause('where', 'period_id', $value); |
| 206 | 206 | }, |
| 207 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 207 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 208 | 208 | $period = \App\Models\Period::get_default_period()->id; |
| 209 | 209 | CRUD::addClause('where', 'period_id', $period); |
| 210 | 210 | $this->crud->getRequest()->request->add(['period_id' => $period]); // to make the filter look active |
@@ -87,8 +87,8 @@ discard block |
||
| 87 | 87 | }, function ($value) { // if the filter is active |
| 88 | 88 | CRUD::addClause('where', 'rhythm_id', $value); |
| 89 | 89 | }, |
| 90 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 91 | - }); |
|
| 90 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 91 | + }); |
|
| 92 | 92 | |
| 93 | 93 | CRUD::addFilter([ // select2 filter |
| 94 | 94 | 'name' => 'teacher_id', |
@@ -99,8 +99,8 @@ discard block |
||
| 99 | 99 | }, function ($value) { // if the filter is active |
| 100 | 100 | CRUD::addClause('where', 'teacher_id', $value); |
| 101 | 101 | }, |
| 102 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 103 | - }); |
|
| 102 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 103 | + }); |
|
| 104 | 104 | |
| 105 | 105 | CRUD::addFilter([ // select2 filter |
| 106 | 106 | 'name' => 'level_id', |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | }, function ($value) { // if the filter is active |
| 112 | 112 | CRUD::addClause('where', 'level_id', $value); |
| 113 | 113 | }, |
| 114 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 115 | - }); |
|
| 114 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 115 | + }); |
|
| 116 | 116 | |
| 117 | 117 | CRUD::addFilter([ // select2 filter |
| 118 | 118 | 'name' => 'period_id', |
@@ -123,11 +123,11 @@ discard block |
||
| 123 | 123 | }, function ($value) { // if the filter is active |
| 124 | 124 | CRUD::addClause('where', 'period_id', $value); |
| 125 | 125 | }, |
| 126 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 127 | - $period = \App\Models\Period::get_default_period()->id; |
|
| 128 | - CRUD::addClause('where', 'period_id', $period); |
|
| 129 | - $this->crud->getRequest()->request->add(['period_id' => $period]); // to make the filter look active |
|
| 130 | - }); |
|
| 126 | + function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 127 | + $period = \App\Models\Period::get_default_period()->id; |
|
| 128 | + CRUD::addClause('where', 'period_id', $period); |
|
| 129 | + $this->crud->getRequest()->request->add(['period_id' => $period]); // to make the filter look active |
|
| 130 | + }); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | protected function setupCreateOperation() |
@@ -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', |
@@ -60,12 +60,12 @@ discard block |
||
| 60 | 60 | 'attribute' => 'lastname', // foreign key attribute that is shown to user |
| 61 | 61 | 'model' => "App\Models\User", // foreign key model |
| 62 | 62 | 'orderable' => true, |
| 63 | - 'orderLogic' => function ($query, $column, $columnDirection) { |
|
| 63 | + 'orderLogic' => function($query, $column, $columnDirection) { |
|
| 64 | 64 | return $query->leftJoin('users', 'users.id', '=', 'students.user_id') |
| 65 | 65 | ->orderBy('users.lastname', $columnDirection)->select('students.*'); |
| 66 | 66 | }, |
| 67 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 68 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 67 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 68 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 69 | 69 | $q->where('lastname', 'like', '%'.$searchTerm.'%'); |
| 70 | 70 | }); |
| 71 | 71 | }, |
@@ -80,12 +80,12 @@ discard block |
||
| 80 | 80 | 'attribute' => 'firstname', // foreign key attribute that is shown to user |
| 81 | 81 | 'model' => "App\Models\User", // foreign key model |
| 82 | 82 | 'orderable' => true, |
| 83 | - 'orderLogic' => function ($query, $column, $columnDirection) { |
|
| 83 | + 'orderLogic' => function($query, $column, $columnDirection) { |
|
| 84 | 84 | return $query->leftJoin('users', 'users.id', '=', 'students.user_id') |
| 85 | 85 | ->orderBy('users.firstname', $columnDirection)->select('students.*'); |
| 86 | 86 | }, |
| 87 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 88 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 87 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 88 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 89 | 89 | $q->where('firstname', 'like', '%'.$searchTerm.'%'); |
| 90 | 90 | }); |
| 91 | 91 | }, |
@@ -100,12 +100,12 @@ discard block |
||
| 100 | 100 | 'attribute' => 'email', // foreign key attribute that is shown to user |
| 101 | 101 | 'model' => "App\Models\User", // foreign key model |
| 102 | 102 | 'orderable' => true, |
| 103 | - 'orderLogic' => function ($query, $column, $columnDirection) { |
|
| 103 | + 'orderLogic' => function($query, $column, $columnDirection) { |
|
| 104 | 104 | return $query->leftJoin('users', 'users.id', '=', 'students.user_id') |
| 105 | 105 | ->orderBy('users.email', $columnDirection)->select('students.*'); |
| 106 | 106 | }, |
| 107 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 108 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 107 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 108 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 109 | 109 | $q->where('email', 'like', '%'.$searchTerm.'%'); |
| 110 | 110 | }); |
| 111 | 111 | }, |
@@ -123,32 +123,32 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | ]); |
| 125 | 125 | |
| 126 | - CRUD::addFilter([ // select2 filter |
|
| 126 | + CRUD::addFilter([// select2 filter |
|
| 127 | 127 | 'name' => 'enrolled', |
| 128 | 128 | 'type' => 'select2', |
| 129 | 129 | 'label'=> __('Is Enrolled in'), |
| 130 | - ], function () { |
|
| 130 | + ], function() { |
|
| 131 | 131 | return Period::all()->pluck('name', 'id')->toArray(); |
| 132 | - }, function ($value) { // if the filter is active |
|
| 133 | - $this->crud->query = $this->crud->query->whereHas('enrollments', function ($query) use ($value) { |
|
| 134 | - return $query->whereHas('course', function ($q) use ($value) { |
|
| 132 | + }, function($value) { // if the filter is active |
|
| 133 | + $this->crud->query = $this->crud->query->whereHas('enrollments', function($query) use ($value) { |
|
| 134 | + return $query->whereHas('course', function($q) use ($value) { |
|
| 135 | 135 | $q->where('period_id', $value); |
| 136 | 136 | }); |
| 137 | 137 | }); |
| 138 | 138 | }, |
| 139 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 139 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 140 | 140 | }); |
| 141 | 141 | |
| 142 | - CRUD::addFilter([ // select2_multiple filter |
|
| 142 | + CRUD::addFilter([// select2_multiple filter |
|
| 143 | 143 | 'name' => 'notenrolled', |
| 144 | 144 | 'type' => 'select2_multiple', |
| 145 | 145 | 'label'=> __('Is Not Enrolled in'), |
| 146 | - ], function () { // the options that show up in the select2 |
|
| 146 | + ], function() { // the options that show up in the select2 |
|
| 147 | 147 | return Period::all()->pluck('name', 'id')->toArray(); |
| 148 | - }, function ($values) { // if the filter is active |
|
| 148 | + }, function($values) { // if the filter is active |
|
| 149 | 149 | foreach (json_decode($values) as $key => $value) { |
| 150 | - $this->crud->query = $this->crud->query->whereDoesntHave('enrollments', function ($query) use ($value) { |
|
| 151 | - return $query->whereHas('course', function ($q) use ($value) { |
|
| 150 | + $this->crud->query = $this->crud->query->whereDoesntHave('enrollments', function($query) use ($value) { |
|
| 151 | + return $query->whereHas('course', function($q) use ($value) { |
|
| 152 | 152 | $q->where('period_id', $value); |
| 153 | 153 | }); |
| 154 | 154 | }); |
@@ -160,9 +160,9 @@ discard block |
||
| 160 | 160 | 'name' => 'institution_id', |
| 161 | 161 | 'type' => 'select2', |
| 162 | 162 | 'label' => __('Institution'), |
| 163 | - ], function () { |
|
| 163 | + ], function() { |
|
| 164 | 164 | return Institution::all()->pluck('name', 'id')->toArray(); |
| 165 | - }, function ($value) { // if the filter is active |
|
| 165 | + }, function($value) { // if the filter is active |
|
| 166 | 166 | $this->crud->addClause('where', 'institution_id', $value); |
| 167 | 167 | }); |
| 168 | 168 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | { |
| 172 | 172 | $student = Student::findOrFail($student); |
| 173 | 173 | |
| 174 | - if (! backpack_user()->isTeacher() && ! backpack_user()->can('enrollments.view')) { |
|
| 174 | + if (!backpack_user()->isTeacher() && !backpack_user()->can('enrollments.view')) { |
|
| 175 | 175 | abort(403); |
| 176 | 176 | } |
| 177 | 177 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | CRUD::setValidation(StoreRequest::class); |
| 65 | 65 | CRUD::addFields([ |
| 66 | - [ // Select2 |
|
| 66 | + [// Select2 |
|
| 67 | 67 | 'label' => 'User', |
| 68 | 68 | 'type' => 'select2', |
| 69 | 69 | 'name' => 'user_id', // the db column for the foreign key |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | protected function setupUpdateOperation() |
| 89 | 89 | { |
| 90 | 90 | CRUD::addFields([ |
| 91 | - [ // Select2 |
|
| 91 | + [// Select2 |
|
| 92 | 92 | 'label' => 'User', |
| 93 | 93 | 'type' => 'select2', |
| 94 | 94 | 'name' => 'user_id', // the db column for the foreign key |
@@ -86,10 +86,10 @@ discard block |
||
| 86 | 86 | 'name' => 'action', |
| 87 | 87 | 'label'=> 'Action', |
| 88 | 88 | ], |
| 89 | - false, |
|
| 90 | - function () { // if the filter is active |
|
| 91 | - CRUD::addClause('where', 'action', true); |
|
| 92 | - }); |
|
| 89 | + false, |
|
| 90 | + function () { // if the filter is active |
|
| 91 | + CRUD::addClause('where', 'action', true); |
|
| 92 | + }); |
|
| 93 | 93 | |
| 94 | 94 | CRUD::addFilter([ // dropdown filter |
| 95 | 95 | 'name' => 'type', |
@@ -103,10 +103,10 @@ discard block |
||
| 103 | 103 | ], function ($value) { // if the filter is active |
| 104 | 104 | CRUD::addClause('where', 'commentable_type', '=', $value); |
| 105 | 105 | }, |
| 106 | - function () { // if the filter is not active |
|
| 107 | - CRUD::addClause('where', 'commentable_type', '=', \App\Models\Student::class); |
|
| 108 | - $this->crud->getRequest()->request->add(['commentable_type' => \App\Models\Student::class]); // to make the filter look active |
|
| 109 | - }); |
|
| 106 | + function () { // if the filter is not active |
|
| 107 | + CRUD::addClause('where', 'commentable_type', '=', \App\Models\Student::class); |
|
| 108 | + $this->crud->getRequest()->request->add(['commentable_type' => \App\Models\Student::class]); // to make the filter look active |
|
| 109 | + }); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | public function setupUpdateOperation() |
@@ -81,17 +81,17 @@ discard block |
||
| 81 | 81 | ], |
| 82 | 82 | ]); |
| 83 | 83 | |
| 84 | - CRUD::addFilter([ // simple filter |
|
| 84 | + CRUD::addFilter([// simple filter |
|
| 85 | 85 | 'type' => 'simple', |
| 86 | 86 | 'name' => 'action', |
| 87 | 87 | 'label'=> 'Action', |
| 88 | 88 | ], |
| 89 | 89 | false, |
| 90 | - function () { // if the filter is active |
|
| 90 | + function() { // if the filter is active |
|
| 91 | 91 | CRUD::addClause('where', 'action', true); |
| 92 | 92 | }); |
| 93 | 93 | |
| 94 | - CRUD::addFilter([ // dropdown filter |
|
| 94 | + CRUD::addFilter([// dropdown filter |
|
| 95 | 95 | 'name' => 'type', |
| 96 | 96 | 'type' => 'dropdown', |
| 97 | 97 | 'label'=> 'Type', |
@@ -100,10 +100,10 @@ discard block |
||
| 100 | 100 | \App\Models\Enrollment::class => 'Enrollments', |
| 101 | 101 | \App\Models\Result::class => 'Result', |
| 102 | 102 | |
| 103 | - ], function ($value) { // if the filter is active |
|
| 103 | + ], function($value) { // if the filter is active |
|
| 104 | 104 | CRUD::addClause('where', 'commentable_type', '=', $value); |
| 105 | 105 | }, |
| 106 | - function () { // if the filter is not active |
|
| 106 | + function() { // if the filter is not active |
|
| 107 | 107 | CRUD::addClause('where', 'commentable_type', '=', \App\Models\Student::class); |
| 108 | 108 | $this->crud->getRequest()->request->add(['commentable_type' => \App\Models\Student::class]); // to make the filter look active |
| 109 | 109 | }); |
@@ -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]); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | protected function setupListOperation() |
| 30 | 30 | { |
| 31 | 31 | CRUD::setColumns([ |
| 32 | - [ // skill type |
|
| 32 | + [// skill type |
|
| 33 | 33 | 'label' => 'Type', // Table column heading |
| 34 | 34 | 'type' => 'select', |
| 35 | 35 | 'name' => 'skill_type', // the method that defines the relationship in your Model |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | 'type' => 'text', |
| 43 | 43 | 'name' => 'name', |
| 44 | 44 | ], |
| 45 | - [ // skill level |
|
| 45 | + [// skill level |
|
| 46 | 46 | 'label' => 'Level', // Table column heading |
| 47 | 47 | 'type' => 'select', |
| 48 | 48 | 'name' => 'level', // the method that defines the relationship in your Model |
@@ -54,23 +54,23 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | CRUD::enableBulkActions(); |
| 56 | 56 | |
| 57 | - CRUD::addFilter([ // select2 filter |
|
| 57 | + CRUD::addFilter([// select2 filter |
|
| 58 | 58 | 'name' => 'level_id', |
| 59 | 59 | 'type' => 'select2', |
| 60 | 60 | 'label'=> 'Level', |
| 61 | - ], function () { |
|
| 61 | + ], function() { |
|
| 62 | 62 | return \App\Models\Level::all()->pluck('name', 'id')->toArray(); |
| 63 | - }, function ($value) { // if the filter is active |
|
| 63 | + }, function($value) { // if the filter is active |
|
| 64 | 64 | CRUD::addClause('where', 'level_id', $value); |
| 65 | 65 | }); |
| 66 | 66 | |
| 67 | - CRUD::addFilter([ // select2 filter |
|
| 67 | + CRUD::addFilter([// select2 filter |
|
| 68 | 68 | 'name' => 'skill_type_id', |
| 69 | 69 | 'type' => 'select2', |
| 70 | 70 | 'label'=> 'Type', |
| 71 | - ], function () { |
|
| 71 | + ], function() { |
|
| 72 | 72 | return \App\Models\Skills\SkillType::all()->pluck('name', 'id')->toArray(); |
| 73 | - }, function ($value) { // if the filter is active |
|
| 73 | + }, function($value) { // if the filter is active |
|
| 74 | 74 | CRUD::addClause('where', 'skill_type_id', $value); |
| 75 | 75 | }); |
| 76 | 76 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | { |
| 80 | 80 | CRUD::setValidation(StoreRequest::class); |
| 81 | 81 | CRUD::addFields([ |
| 82 | - [ // skill type |
|
| 82 | + [// skill type |
|
| 83 | 83 | 'label' => 'Type', // Table column heading |
| 84 | 84 | 'type' => 'select', |
| 85 | 85 | 'name' => 'skill_type_id', // the db column for the foreign key |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | 'type' => 'text', |
| 93 | 93 | 'name' => 'name', |
| 94 | 94 | ], |
| 95 | - [ // skill level |
|
| 95 | + [// skill level |
|
| 96 | 96 | 'label' => 'Level', // Table column heading |
| 97 | 97 | 'type' => 'select', |
| 98 | 98 | 'name' => 'level_id', // the db column for the foreign key |
@@ -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 | }); |