@@ -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 | } |
@@ -116,13 +116,13 @@ discard block |
||
| 116 | 116 | ]); |
| 117 | 117 | |
| 118 | 118 | CRUD::addFilter( |
| 119 | - [ // daterange filter |
|
| 119 | + [// daterange filter |
|
| 120 | 120 | 'type' => 'date_range', |
| 121 | 121 | 'name' => 'from_to', |
| 122 | 122 | 'label' => __('Date range'), |
| 123 | 123 | ], |
| 124 | 124 | false, |
| 125 | - function ($value) { // if the filter is active, apply these constraints |
|
| 125 | + function($value) { // if the filter is active, apply these constraints |
|
| 126 | 126 | $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR); |
| 127 | 127 | |
| 128 | 128 | if ($dates->from) { |
@@ -141,10 +141,10 @@ discard block |
||
| 141 | 141 | 'label' => __('Events with no course'), |
| 142 | 142 | ], |
| 143 | 143 | false, |
| 144 | - function ($value) { // if the filter is active, apply these constraints |
|
| 144 | + function($value) { // if the filter is active, apply these constraints |
|
| 145 | 145 | $this->crud->query->where('course_id', null); |
| 146 | 146 | }, |
| 147 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 147 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 148 | 148 | } |
| 149 | 149 | ); |
| 150 | 150 | |
@@ -155,22 +155,22 @@ discard block |
||
| 155 | 155 | 'label' => __('Events with no teacher'), |
| 156 | 156 | ], |
| 157 | 157 | false, |
| 158 | - function ($value) { // if the filter is active, apply these constraints |
|
| 158 | + function($value) { // if the filter is active, apply these constraints |
|
| 159 | 159 | CRUD::addClause('unassigned'); |
| 160 | 160 | } |
| 161 | 161 | ); |
| 162 | 162 | |
| 163 | 163 | CRUD::addFilter( |
| 164 | - [ // select2 filter |
|
| 164 | + [// select2 filter |
|
| 165 | 165 | 'name' => 'teacher_id', |
| 166 | 166 | 'type' => 'select2', |
| 167 | 167 | 'label' => __('Teacher'), |
| 168 | 168 | ], |
| 169 | - fn () => Teacher::all()->pluck('name', 'id')->toArray(), |
|
| 170 | - function ($value) { |
|
| 169 | + fn() => Teacher::all()->pluck('name', 'id')->toArray(), |
|
| 170 | + function($value) { |
|
| 171 | 171 | CRUD::addClause('where', 'teacher_id', $value); |
| 172 | 172 | }, |
| 173 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 173 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 174 | 174 | } |
| 175 | 175 | ); |
| 176 | 176 | } |
@@ -92,10 +92,10 @@ discard block |
||
| 92 | 92 | 'attribute' => 'lastname', |
| 93 | 93 | 'model' => User::class, |
| 94 | 94 | 'orderable' => true, |
| 95 | - 'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
| 95 | + 'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
| 96 | 96 | ->orderBy('users.lastname', $columnDirection)->select('students.*'), |
| 97 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 98 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 97 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 98 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 99 | 99 | $q->where('lastname', 'like', '%'.$searchTerm.'%'); |
| 100 | 100 | }); |
| 101 | 101 | }, |
@@ -110,10 +110,10 @@ discard block |
||
| 110 | 110 | 'attribute' => 'firstname', |
| 111 | 111 | 'model' => User::class, |
| 112 | 112 | 'orderable' => true, |
| 113 | - 'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
| 113 | + 'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
| 114 | 114 | ->orderBy('users.firstname', $columnDirection)->select('students.*'), |
| 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,10 +127,10 @@ discard block |
||
| 127 | 127 | 'attribute' => 'email', |
| 128 | 128 | 'model' => User::class, |
| 129 | 129 | 'orderable' => true, |
| 130 | - 'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
| 130 | + 'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
| 131 | 131 | ->orderBy('users.email', $columnDirection)->select('students.*'), |
| 132 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 133 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 132 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 133 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 134 | 134 | $q->where('email', 'like', '%'.$searchTerm.'%'); |
| 135 | 135 | }); |
| 136 | 136 | }, |
@@ -177,28 +177,28 @@ discard block |
||
| 177 | 177 | ]); |
| 178 | 178 | |
| 179 | 179 | CRUD::addFilter( |
| 180 | - [ // select2 filter |
|
| 180 | + [// select2 filter |
|
| 181 | 181 | 'name' => 'enrolled', |
| 182 | 182 | 'type' => 'select2', |
| 183 | 183 | 'label' => __('Is Enrolled in'), |
| 184 | 184 | ], |
| 185 | - fn () => Period::all()->pluck('name', 'id')->toArray(), |
|
| 186 | - function ($value) { |
|
| 187 | - $this->crud->query = $this->crud->query->whereHas('enrollments', fn ($query) => $query->whereHas('course', function ($q) use ($value) { |
|
| 185 | + fn() => Period::all()->pluck('name', 'id')->toArray(), |
|
| 186 | + function($value) { |
|
| 187 | + $this->crud->query = $this->crud->query->whereHas('enrollments', fn($query) => $query->whereHas('course', function($q) use ($value) { |
|
| 188 | 188 | $q->where('period_id', $value); |
| 189 | 189 | })); |
| 190 | 190 | }, |
| 191 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 191 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 192 | 192 | } |
| 193 | 193 | ); |
| 194 | 194 | |
| 195 | - CRUD::addFilter([ // select2_multiple filter |
|
| 195 | + CRUD::addFilter([// select2_multiple filter |
|
| 196 | 196 | 'name' => 'notenrolled', |
| 197 | 197 | 'type' => 'select2_multiple', |
| 198 | 198 | 'label' => __('Is Not Enrolled in'), |
| 199 | - ], fn () => Period::all()->pluck('name', 'id')->toArray(), function ($values) { |
|
| 199 | + ], fn() => Period::all()->pluck('name', 'id')->toArray(), function($values) { |
|
| 200 | 200 | foreach (json_decode($values, null, 512, JSON_THROW_ON_ERROR) as $value) { |
| 201 | - $this->crud->query = $this->crud->query->whereDoesntHave('enrollments', fn ($query) => $query->whereHas('course', function ($q) use ($value) { |
|
| 201 | + $this->crud->query = $this->crud->query->whereDoesntHave('enrollments', fn($query) => $query->whereHas('course', function($q) use ($value) { |
|
| 202 | 202 | $q->where('period_id', $value); |
| 203 | 203 | })); |
| 204 | 204 | } |
@@ -210,8 +210,8 @@ discard block |
||
| 210 | 210 | 'type' => 'select2', |
| 211 | 211 | 'label' => __('New In'), |
| 212 | 212 | ], |
| 213 | - fn () => Period::all()->pluck('name', 'id')->toArray(), |
|
| 214 | - function ($value) { |
|
| 213 | + fn() => Period::all()->pluck('name', 'id')->toArray(), |
|
| 214 | + function($value) { |
|
| 215 | 215 | CRUD::addClause('newInPeriod', $value); |
| 216 | 216 | } |
| 217 | 217 | ); |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | 'name' => 'institution_id', |
| 222 | 222 | 'type' => 'select2', |
| 223 | 223 | 'label' => __('Institution'), |
| 224 | - ], fn () => Institution::all()->pluck('name', 'id')->toArray(), function ($value) { |
|
| 224 | + ], fn() => Institution::all()->pluck('name', 'id')->toArray(), function($value) { |
|
| 225 | 225 | $this->crud->addClause('where', 'institution_id', $value); |
| 226 | 226 | }); |
| 227 | 227 | |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | 'name' => 'status_type_id', |
| 230 | 230 | 'type' => 'select2', |
| 231 | 231 | 'label' => __('Lead Status'), |
| 232 | - ], fn () => LeadType::all()->pluck('name', 'id')->toArray(), function ($value) { |
|
| 232 | + ], fn() => LeadType::all()->pluck('name', 'id')->toArray(), function($value) { |
|
| 233 | 233 | if ($value === '4') { |
| 234 | 234 | $this->crud->query = $this->crud->query->where('lead_type_id', $value)->orWhere('lead_type_id', null); |
| 235 | 235 | } else { |
@@ -350,8 +350,8 @@ discard block |
||
| 350 | 350 | $username_parts = array_filter(explode(' ', strtolower($fullName))); |
| 351 | 351 | $username_parts = array_slice($username_parts, -2); |
| 352 | 352 | |
| 353 | - $part1 = (! empty($username_parts[0])) ? substr($username_parts[0], 0, 3) : ''; |
|
| 354 | - $part2 = (! empty($username_parts[1])) ? substr($username_parts[1], 0, 8) : ''; |
|
| 353 | + $part1 = (!empty($username_parts[0])) ? substr($username_parts[0], 0, 3) : ''; |
|
| 354 | + $part2 = (!empty($username_parts[1])) ? substr($username_parts[1], 0, 8) : ''; |
|
| 355 | 355 | $part3 = random_int(999, 9999); |
| 356 | 356 | |
| 357 | 357 | $username = $part1.$part2.$part3; //str_shuffle to randomly shuffle all characters |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | { |
| 440 | 440 | $student = Student::findOrFail($student); |
| 441 | 441 | |
| 442 | - if (! backpack_user()->isTeacher() && ! backpack_user()->can('enrollments.view')) { |
|
| 442 | + if (!backpack_user()->isTeacher() && !backpack_user()->can('enrollments.view')) { |
|
| 443 | 443 | abort(403); |
| 444 | 444 | } |
| 445 | 445 | |
@@ -46,10 +46,10 @@ discard block |
||
| 46 | 46 | 'attribute' => 'lastname', |
| 47 | 47 | 'model' => User::class, |
| 48 | 48 | 'orderable' => true, |
| 49 | - 'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
| 49 | + 'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id') |
|
| 50 | 50 | ->orderBy('users.lastname', $columnDirection)->select('students.*'), |
| 51 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 52 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 51 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 52 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 53 | 53 | $q->where('lastname', 'like', '%'.$searchTerm.'%'); |
| 54 | 54 | }); |
| 55 | 55 | }, |
@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | 'attribute' => 'firstname', |
| 65 | 65 | 'model' => User::class, |
| 66 | 66 | 'orderable' => true, |
| 67 | - 'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'teachers.id') |
|
| 67 | + 'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'teachers.id') |
|
| 68 | 68 | ->orderBy('users.firstname', $columnDirection)->select('teachers.*'), |
| 69 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 70 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 69 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 70 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 71 | 71 | $q->where('firstname', 'like', '%'.$searchTerm.'%'); |
| 72 | 72 | }); |
| 73 | 73 | }, |
@@ -81,10 +81,10 @@ discard block |
||
| 81 | 81 | 'attribute' => 'email', |
| 82 | 82 | 'model' => User::class, |
| 83 | 83 | 'orderable' => true, |
| 84 | - 'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'teachers.id') |
|
| 84 | + 'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'teachers.id') |
|
| 85 | 85 | ->orderBy('users.email', $columnDirection)->select('teachers.*'), |
| 86 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 87 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 86 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 87 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 88 | 88 | $q->where('email', 'like', '%'.$searchTerm.'%'); |
| 89 | 89 | }); |
| 90 | 90 | }, |
@@ -181,8 +181,8 @@ discard block |
||
| 181 | 181 | $username_parts = array_filter(explode(' ', strtolower($fullName))); |
| 182 | 182 | $username_parts = array_slice($username_parts, -2); |
| 183 | 183 | |
| 184 | - $part1 = (! empty($username_parts[0])) ? substr($username_parts[0], 0, 3) : ''; |
|
| 185 | - $part2 = (! empty($username_parts[1])) ? substr($username_parts[1], 0, 8) : ''; |
|
| 184 | + $part1 = (!empty($username_parts[0])) ? substr($username_parts[0], 0, 3) : ''; |
|
| 185 | + $part2 = (!empty($username_parts[1])) ? substr($username_parts[1], 0, 8) : ''; |
|
| 186 | 186 | $part3 = random_int(999, 9999); |
| 187 | 187 | |
| 188 | 188 | $username = $part1.$part2.$part3; //str_shuffle to randomly shuffle all characters |
@@ -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', |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | $q->where('firstname', 'like', '%'.$searchTerm.'%') |
| 59 | 59 | ->orWhere('lastname', 'like', '%'.$searchTerm.'%') |
| 60 | 60 | ->orWhere('email', 'like', '%'.$searchTerm.'%') |
| 61 | - ->orWhere('idnumber', 'like', '%'.$searchTerm.'%'); |
|
| 61 | + ->orWhere('idnumber', 'like', '%'.$searchTerm.'%'); |
|
| 62 | 62 | }); |
| 63 | 63 | }); |
| 64 | 64 | }, |
@@ -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', |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | protected function setupListOperation() |
| 33 | 33 | { |
| 34 | 34 | CRUD::setColumns([ |
| 35 | - [ // skill type |
|
| 35 | + [// skill type |
|
| 36 | 36 | 'label' => 'Type', |
| 37 | 37 | 'type' => 'select', |
| 38 | 38 | 'name' => 'skill_type', |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | 'type' => 'text', |
| 47 | 47 | 'name' => 'name', |
| 48 | 48 | ], |
| 49 | - [ // skill level |
|
| 49 | + [// skill level |
|
| 50 | 50 | 'label' => 'Level', |
| 51 | 51 | 'type' => 'select', |
| 52 | 52 | 'name' => 'level', |
@@ -58,19 +58,19 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | CRUD::enableExportButtons(); |
| 60 | 60 | |
| 61 | - CRUD::addFilter([ // select2 filter |
|
| 61 | + CRUD::addFilter([// select2 filter |
|
| 62 | 62 | 'name' => 'level_id', |
| 63 | 63 | 'type' => 'select2', |
| 64 | 64 | 'label' => 'Level', |
| 65 | - ], fn () => Level::all()->pluck('name', 'id')->toArray(), function ($value) { |
|
| 65 | + ], fn() => Level::all()->pluck('name', 'id')->toArray(), function($value) { |
|
| 66 | 66 | CRUD::addClause('where', 'level_id', $value); |
| 67 | 67 | }); |
| 68 | 68 | |
| 69 | - CRUD::addFilter([ // select2 filter |
|
| 69 | + CRUD::addFilter([// select2 filter |
|
| 70 | 70 | 'name' => 'skill_type_id', |
| 71 | 71 | 'type' => 'select2', |
| 72 | 72 | 'label' => 'Type', |
| 73 | - ], fn () => SkillType::all()->pluck('name', 'id')->toArray(), function ($value) { |
|
| 73 | + ], fn() => SkillType::all()->pluck('name', 'id')->toArray(), function($value) { |
|
| 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', |
| 84 | 84 | 'type' => 'select', |
| 85 | 85 | 'name' => 'skill_type_id', |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | 'type' => 'text', |
| 94 | 94 | 'name' => 'name', |
| 95 | 95 | ], |
| 96 | - [ // skill level |
|
| 96 | + [// skill level |
|
| 97 | 97 | 'label' => 'Level', |
| 98 | 98 | 'type' => 'select', |
| 99 | 99 | 'name' => 'level_id', |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | 'type' => 'relationship', |
| 107 | 107 | 'name' => 'skill_type', |
| 108 | 108 | 'ajax' => true, |
| 109 | - 'inline_create' => [ // specify the entity in singular |
|
| 109 | + 'inline_create' => [// specify the entity in singular |
|
| 110 | 110 | 'entity' => 'skilltype', |
| 111 | 111 | // the entity in singular |
| 112 | 112 | // OPTIONALS |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | public function teacher(Request $request) |
| 46 | 46 | { |
| 47 | - if (! backpack_user()->isTeacher()) { |
|
| 47 | + if (!backpack_user()->isTeacher()) { |
|
| 48 | 48 | abort(403); |
| 49 | 49 | } |
| 50 | 50 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | public function student() |
| 71 | 71 | { |
| 72 | - if (! backpack_user()->isStudent()) { |
|
| 72 | + if (!backpack_user()->isStudent()) { |
|
| 73 | 73 | abort(403); |
| 74 | 74 | } |
| 75 | 75 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $currentPeriod = Period::get_default_period(); |
| 88 | 88 | $enrollmentsPeriod = Period::get_enrollments_period(); |
| 89 | 89 | |
| 90 | - if (! backpack_user()->hasRole(['admin', 'secretary'])) { |
|
| 90 | + if (!backpack_user()->hasRole(['admin', 'secretary'])) { |
|
| 91 | 91 | abort(403); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | // todo optimize this !! |
| 97 | 97 | $events = Event::where('start', '>', Carbon::now()->subDays(15))->where('end', '<', Carbon::now()->addDays(15))->orderBy('id', 'desc') |
| 98 | 98 | ->get() |
| 99 | - ->map(fn ($event) => [ |
|
| 99 | + ->map(fn($event) => [ |
|
| 100 | 100 | 'title' => $event['name'], |
| 101 | 101 | 'resourceId' => $event['teacher_id'], |
| 102 | 102 | 'start' => $event['start'], |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | $teachers = Teacher::with('user')->get()->toArray(); |
| 110 | 110 | |
| 111 | - $teachers = array_map(fn ($teacher) => [ |
|
| 111 | + $teachers = array_map(fn($teacher) => [ |
|
| 112 | 112 | 'id' => $teacher['id'], |
| 113 | 113 | 'title' => $teacher['user']['firstname'], |
| 114 | 114 | ], $teachers); |