@@ -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 | //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 | |
@@ -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 () { // if the filter is active, apply these constraints |
|
| 144 | + function() { // 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 () { // if the filter is active, apply these constraints |
|
| 158 | + function() { // 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 | } |
@@ -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 | //str_shuffle to randomly shuffle all characters |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | $username_parts = array_filter(explode(' ', strtolower($fullName))); |
| 32 | 32 | $username_parts = array_slice($username_parts, -2); |
| 33 | 33 | |
| 34 | - $part1 = (! empty($username_parts[0])) ? substr($username_parts[0], 0, 3) : ''; |
|
| 35 | - $part2 = (! empty($username_parts[1])) ? substr($username_parts[1], 0, 8) : ''; |
|
| 34 | + $part1 = (!empty($username_parts[0])) ? substr($username_parts[0], 0, 3) : ''; |
|
| 35 | + $part2 = (!empty($username_parts[1])) ? substr($username_parts[1], 0, 8) : ''; |
|
| 36 | 36 | $part3 = random_int(999, 9999); |
| 37 | 37 | |
| 38 | 38 | //str_shuffle to randomly shuffle all characters |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | { |
| 125 | 125 | |
| 126 | 126 | // if registration is closed, deny access |
| 127 | - if (! config('backpack.base.registration_open')) { |
|
| 127 | + if (!config('backpack.base.registration_open')) { |
|
| 128 | 128 | abort(403, trans('backpack::base.registration_closed')); |
| 129 | 129 | } |
| 130 | 130 | |