@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | public function teacher(Request $request) |
| 48 | 48 | { |
| 49 | - if (! backpack_user()->isTeacher()) { |
|
| 49 | + if (!backpack_user()->isTeacher()) { |
|
| 50 | 50 | abort(403); |
| 51 | 51 | } |
| 52 | 52 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | public function student() |
| 72 | 72 | { |
| 73 | - if (! backpack_user()->isStudent()) { |
|
| 73 | + if (!backpack_user()->isStudent()) { |
|
| 74 | 74 | abort(403); |
| 75 | 75 | } |
| 76 | 76 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $currentPeriod = Period::get_default_period(); |
| 89 | 89 | $enrollmentsPeriod = Period::get_enrollments_period(); |
| 90 | 90 | |
| 91 | - if (! backpack_user()->hasRole(['admin', 'secretary'])) { |
|
| 91 | + if (!backpack_user()->hasRole(['admin', 'secretary'])) { |
|
| 92 | 92 | abort(403); |
| 93 | 93 | } |
| 94 | 94 | |
@@ -99,14 +99,14 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | $teachers = Teacher::with('user')->get()->toArray(); |
| 101 | 101 | |
| 102 | - $teachers = array_map(function ($teacher) { |
|
| 102 | + $teachers = array_map(function($teacher) { |
|
| 103 | 103 | return [ |
| 104 | 104 | 'id' => $teacher['id'], |
| 105 | 105 | 'title' => $teacher['user']['firstname'], |
| 106 | 106 | ]; |
| 107 | 107 | }, $teachers); |
| 108 | 108 | |
| 109 | - $events = array_map(function ($event) { |
|
| 109 | + $events = array_map(function($event) { |
|
| 110 | 110 | return [ |
| 111 | 111 | 'title' => $event['name'], |
| 112 | 112 | 'resourceId' => $event['teacher_id'], |
@@ -169,9 +169,9 @@ |
||
| 169 | 169 | // add photo |
| 170 | 170 | if($request->data['userPicture']) { |
| 171 | 171 | $student |
| 172 | - ->addMediaFromBase64($request->data['userPicture']) |
|
| 173 | - ->usingFileName('profilePicture.jpg') |
|
| 174 | - ->toMediaCollection('profile-picture'); |
|
| 172 | + ->addMediaFromBase64($request->data['userPicture']) |
|
| 173 | + ->usingFileName('profilePicture.jpg') |
|
| 174 | + ->toMediaCollection('profile-picture'); |
|
| 175 | 175 | |
| 176 | 176 | Log::info('Profile picture added to the student profile'); |
| 177 | 177 | } |
@@ -30,11 +30,11 @@ discard block |
||
| 30 | 30 | $username_parts = array_filter(explode(" ", strtolower($fullName))); |
| 31 | 31 | $username_parts = array_slice($username_parts, -2); |
| 32 | 32 | |
| 33 | - $part1 = (!empty($username_parts[0]))?substr($username_parts[0], 0,3):""; |
|
| 34 | - $part2 = (!empty($username_parts[1]))?substr($username_parts[1], 0,8):""; |
|
| 33 | + $part1 = (!empty($username_parts[0])) ?substr($username_parts[0], 0, 3) : ""; |
|
| 34 | + $part2 = (!empty($username_parts[1])) ?substr($username_parts[1], 0, 8) : ""; |
|
| 35 | 35 | $part3 = rand(999, 9999); |
| 36 | 36 | |
| 37 | - $username = $part1. $part2. $part3; //str_shuffle to randomly shuffle all characters |
|
| 37 | + $username = $part1.$part2.$part3; //str_shuffle to randomly shuffle all characters |
|
| 38 | 38 | |
| 39 | 39 | return $username; |
| 40 | 40 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $username = $data['email']; |
| 84 | 84 | } |
| 85 | 85 | else { |
| 86 | - $username = $this->generateUsername($data['firstname'] . ' ' . $data['lastname']); |
|
| 86 | + $username = $this->generateUsername($data['firstname'].' '.$data['lastname']); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | // create the user |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | { |
| 124 | 124 | |
| 125 | 125 | // if registration is closed, deny access |
| 126 | - if (! config('backpack.base.registration_open')) { |
|
| 126 | + if (!config('backpack.base.registration_open')) { |
|
| 127 | 127 | abort(403, trans('backpack::base.registration_closed')); |
| 128 | 128 | } |
| 129 | 129 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | Log::info('Profession and institution added to the student profile'); |
| 168 | 168 | |
| 169 | 169 | // add photo |
| 170 | - if($request->data['userPicture']) { |
|
| 170 | + if ($request->data['userPicture']) { |
|
| 171 | 171 | $student |
| 172 | 172 | ->addMediaFromBase64($request->data['userPicture']) |
| 173 | 173 | ->usingFileName('profilePicture.jpg') |
@@ -81,8 +81,7 @@ |
||
| 81 | 81 | if (User::where('email', $data['email'])->count() === 0) |
| 82 | 82 | { |
| 83 | 83 | $username = $data['email']; |
| 84 | - } |
|
| 85 | - else { |
|
| 84 | + } else { |
|
| 86 | 85 | $username = $this->generateUsername($data['firstname'] . ' ' . $data['lastname']); |
| 87 | 86 | } |
| 88 | 87 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $year_data = []; |
| 63 | 63 | $years = []; // New array |
| 64 | 64 | |
| 65 | - if (! isset($request->period)) { |
|
| 65 | + if (!isset($request->period)) { |
|
| 66 | 66 | $startperiod = Period::find(Config::where('name', 'first_external_period')->first()->value ?? Period::first()->id); |
| 67 | 67 | } else { |
| 68 | 68 | $startperiod = Period::find($request->period); |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | { |
| 164 | 164 | $period = Period::get_default_period(); |
| 165 | 165 | |
| 166 | - if (! isset($request->period)) { |
|
| 166 | + if (!isset($request->period)) { |
|
| 167 | 167 | $startperiod = Period::find(Config::where('name', 'first_period')->first()->value); |
| 168 | 168 | } else { |
| 169 | 169 | $startperiod = Period::find($request->period); |
@@ -239,10 +239,10 @@ discard block |
||
| 239 | 239 | CRUD::addClause('where', 'period_id', $value); |
| 240 | 240 | }, |
| 241 | 241 | function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
| 242 | - $period = \App\Models\Period::get_default_period()->id; |
|
| 243 | - CRUD::addClause('where', 'period_id', $period); |
|
| 244 | - $this->crud->getRequest()->request->add(['period_id' => $period]); // to make the filter look active |
|
| 245 | - } |
|
| 242 | + $period = \App\Models\Period::get_default_period()->id; |
|
| 243 | + CRUD::addClause('where', 'period_id', $period); |
|
| 244 | + $this->crud->getRequest()->request->add(['period_id' => $period]); // to make the filter look active |
|
| 245 | + } |
|
| 246 | 246 | ); |
| 247 | 247 | |
| 248 | 248 | CRUD::addFilter( |
@@ -253,8 +253,8 @@ discard block |
||
| 253 | 253 | ], |
| 254 | 254 | false, |
| 255 | 255 | function () { |
| 256 | - CRUD::addClause('parent'); |
|
| 257 | - } |
|
| 256 | + CRUD::addClause('parent'); |
|
| 257 | + } |
|
| 258 | 258 | ); |
| 259 | 259 | |
| 260 | 260 | $this->crud->addFilter([ |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | 'type' => 'number' |
| 381 | 381 | ], $currency), |
| 382 | 382 | |
| 383 | - [ |
|
| 383 | + [ |
|
| 384 | 384 | 'name' => 'volume', // The db column name |
| 385 | 385 | 'label' => __('Presential volume'), // Table column heading |
| 386 | 386 | 'suffix' => 'h', |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | CRUD::addClause('internal'); |
| 57 | 57 | $permissions = backpack_user()->getAllPermissions(); |
| 58 | 58 | |
| 59 | - if (! $permissions->contains('name', 'courses.edit')) { |
|
| 59 | + if (!$permissions->contains('name', 'courses.edit')) { |
|
| 60 | 60 | CRUD::denyAccess('update'); |
| 61 | 61 | CRUD::denyAccess('create'); |
| 62 | 62 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | CRUD::addButtonFromView('line', 'children_badge', 'children_badge', 'beginning'); |
| 69 | 69 | |
| 70 | - if (! $permissions->contains('name', 'courses.delete')) { |
|
| 70 | + if (!$permissions->contains('name', 'courses.delete')) { |
|
| 71 | 71 | CRUD::denyAccess('delete'); |
| 72 | 72 | } |
| 73 | 73 | |
@@ -189,13 +189,13 @@ discard block |
||
| 189 | 189 | 'name' => 'rhythm_id', |
| 190 | 190 | 'type' => 'select2', |
| 191 | 191 | 'label'=> __('Rhythm'), |
| 192 | - ], function () { |
|
| 192 | + ], function() { |
|
| 193 | 193 | return Rhythm::all()->pluck('name', 'id')->toArray(); |
| 194 | - }, function ($value) { |
|
| 194 | + }, function($value) { |
|
| 195 | 195 | // if the filter is active |
| 196 | 196 | CRUD::addClause('where', 'rhythm_id', $value); |
| 197 | 197 | }, |
| 198 | - function () { |
|
| 198 | + function() { |
|
| 199 | 199 | // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
| 200 | 200 | }); |
| 201 | 201 | |
@@ -203,13 +203,13 @@ discard block |
||
| 203 | 203 | 'name' => 'teacher_id', |
| 204 | 204 | 'type' => 'select2', |
| 205 | 205 | 'label'=> __('Teacher'), |
| 206 | - ], function () { |
|
| 206 | + ], function() { |
|
| 207 | 207 | return Teacher::all()->pluck('name', 'id')->toArray(); |
| 208 | - }, function ($value) { |
|
| 208 | + }, function($value) { |
|
| 209 | 209 | // if the filter is active |
| 210 | 210 | CRUD::addClause('where', 'teacher_id', $value); |
| 211 | 211 | }, |
| 212 | - function () { |
|
| 212 | + function() { |
|
| 213 | 213 | // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
| 214 | 214 | }); |
| 215 | 215 | |
@@ -217,13 +217,13 @@ discard block |
||
| 217 | 217 | 'name' => 'level_id', |
| 218 | 218 | 'type' => 'select2', |
| 219 | 219 | 'label'=> __('Level'), |
| 220 | - ], function () { |
|
| 220 | + ], function() { |
|
| 221 | 221 | return Level::all()->pluck('name', 'id')->toArray(); |
| 222 | - }, function ($value) { |
|
| 222 | + }, function($value) { |
|
| 223 | 223 | // if the filter is active |
| 224 | 224 | CRUD::addClause('where', 'level_id', $value); |
| 225 | 225 | }, |
| 226 | - function () { |
|
| 226 | + function() { |
|
| 227 | 227 | // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
| 228 | 228 | }); |
| 229 | 229 | |
@@ -232,13 +232,13 @@ discard block |
||
| 232 | 232 | 'type' => 'select2', |
| 233 | 233 | 'label'=> __('Period'), |
| 234 | 234 | ], |
| 235 | - function () { |
|
| 235 | + function() { |
|
| 236 | 236 | return \App\Models\Period::all()->sortByDesc('id')->pluck('name', 'id')->toArray(); |
| 237 | 237 | }, |
| 238 | - function ($value) { // if the filter is active |
|
| 238 | + function($value) { // if the filter is active |
|
| 239 | 239 | CRUD::addClause('where', 'period_id', $value); |
| 240 | 240 | }, |
| 241 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 241 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
| 242 | 242 | $period = \App\Models\Period::get_default_period()->id; |
| 243 | 243 | CRUD::addClause('where', 'period_id', $period); |
| 244 | 244 | $this->crud->getRequest()->request->add(['period_id' => $period]); // to make the filter look active |
@@ -246,13 +246,13 @@ discard block |
||
| 246 | 246 | ); |
| 247 | 247 | |
| 248 | 248 | CRUD::addFilter( |
| 249 | - [ // add a "simple" filter called Draft |
|
| 249 | + [// add a "simple" filter called Draft |
|
| 250 | 250 | 'type' => 'simple', |
| 251 | 251 | 'name' => 'parent', |
| 252 | 252 | 'label'=> __('Hide Children Courses'), |
| 253 | 253 | ], |
| 254 | 254 | false, |
| 255 | - function () { |
|
| 255 | + function() { |
|
| 256 | 256 | CRUD::addClause('parent'); |
| 257 | 257 | } |
| 258 | 258 | ); |
@@ -263,10 +263,10 @@ discard block |
||
| 263 | 263 | 'label' => __('Start') |
| 264 | 264 | ], |
| 265 | 265 | false, |
| 266 | - function ($value) { // if the filter is active, apply these constraints |
|
| 266 | + function($value) { // if the filter is active, apply these constraints |
|
| 267 | 267 | $dates = json_decode($value); |
| 268 | 268 | $this->crud->addClause('where', 'start_date', '>=', $dates->from); |
| 269 | - $this->crud->addClause('where', 'start_date', '<=', $dates->to . ' 23:59:59'); |
|
| 269 | + $this->crud->addClause('where', 'start_date', '<=', $dates->to.' 23:59:59'); |
|
| 270 | 270 | }); |
| 271 | 271 | |
| 272 | 272 | $this->crud->addFilter([ |
@@ -275,10 +275,10 @@ discard block |
||
| 275 | 275 | 'label' => __('End') |
| 276 | 276 | ], |
| 277 | 277 | false, |
| 278 | - function ($value) { // if the filter is active, apply these constraints |
|
| 278 | + function($value) { // if the filter is active, apply these constraints |
|
| 279 | 279 | $dates = json_decode($value); |
| 280 | 280 | $this->crud->addClause('where', 'end_date', '>=', $dates->from); |
| 281 | - $this->crud->addClause('where', 'end_date', '<=', $dates->to . ' 23:59:59'); |
|
| 281 | + $this->crud->addClause('where', 'end_date', '<=', $dates->to.' 23:59:59'); |
|
| 282 | 282 | }); |
| 283 | 283 | } |
| 284 | 284 | |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | ], |
| 355 | 355 | |
| 356 | 356 | |
| 357 | - [ // repeatable |
|
| 357 | + [// repeatable |
|
| 358 | 358 | 'name' => 'sublevels', |
| 359 | 359 | 'label' => __('Course sublevels'), |
| 360 | 360 | 'type' => 'repeatable', |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | 'default' => Period::get_enrollments_period()->end, |
| 512 | 512 | ], |
| 513 | 513 | |
| 514 | - [ // repeatable |
|
| 514 | + [// repeatable |
|
| 515 | 515 | 'name' => 'times', |
| 516 | 516 | 'label' => __('Course Schedule'), |
| 517 | 517 | 'type' => 'repeatable', |
@@ -574,14 +574,14 @@ discard block |
||
| 574 | 574 | 'init_rows' => 0, // number of empty rows to be initialized, by default 1 |
| 575 | 575 | ], |
| 576 | 576 | |
| 577 | - [ // view |
|
| 577 | + [// view |
|
| 578 | 578 | 'name' => 'custom-ajax-button', |
| 579 | 579 | 'type' => 'view', |
| 580 | 580 | 'view' => 'courses/schedule-preset-alert', |
| 581 | 581 | 'tab' => __('Schedule'), |
| 582 | 582 | ], |
| 583 | 583 | |
| 584 | - [ // select_from_array |
|
| 584 | + [// select_from_array |
|
| 585 | 585 | 'name' => 'schedulepreset', |
| 586 | 586 | 'label' => __('Schedule Preset'), |
| 587 | 587 | 'type' => 'select_from_array', |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | } |
| 606 | 606 | |
| 607 | 607 | if ($this->crud->getCurrentEntry()->children->count() > 0) { |
| 608 | - CRUD::addField([ // view |
|
| 608 | + CRUD::addField([// view |
|
| 609 | 609 | 'name' => 'custom-ajax-button', |
| 610 | 610 | 'type' => 'view', |
| 611 | 611 | 'view' => 'courses/parent-course-alert' |
@@ -613,7 +613,7 @@ discard block |
||
| 613 | 613 | } |
| 614 | 614 | |
| 615 | 615 | if ($this->crud->getCurrentEntry()->parent_course_id !== null) { |
| 616 | - CRUD::addField([ // view |
|
| 616 | + CRUD::addField([// view |
|
| 617 | 617 | 'name' => 'custom-ajax-button', |
| 618 | 618 | 'type' => 'view', |
| 619 | 619 | 'view' => 'courses/child-course-alert' |
@@ -48,12 +48,12 @@ discard block |
||
| 48 | 48 | 'attribute' => 'lastname', // foreign key attribute that is shown to user |
| 49 | 49 | 'model' => 'App\Models\User', // foreign key model |
| 50 | 50 | 'orderable' => true, |
| 51 | - 'orderLogic' => function ($query, $column, $columnDirection) { |
|
| 51 | + 'orderLogic' => function($query, $column, $columnDirection) { |
|
| 52 | 52 | return $query->leftJoin('users', 'users.id', '=', 'students.id') |
| 53 | 53 | ->orderBy('users.lastname', $columnDirection)->select('students.*'); |
| 54 | 54 | }, |
| 55 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 56 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 55 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 56 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 57 | 57 | $q->where('lastname', 'like', '%'.$searchTerm.'%'); |
| 58 | 58 | }); |
| 59 | 59 | }, |
@@ -68,12 +68,12 @@ discard block |
||
| 68 | 68 | 'attribute' => 'firstname', // foreign key attribute that is shown to user |
| 69 | 69 | 'model' => 'App\Models\User', // foreign key model |
| 70 | 70 | 'orderable' => true, |
| 71 | - 'orderLogic' => function ($query, $column, $columnDirection) { |
|
| 71 | + 'orderLogic' => function($query, $column, $columnDirection) { |
|
| 72 | 72 | return $query->leftJoin('users', 'users.id', '=', 'teachers.id') |
| 73 | 73 | ->orderBy('users.firstname', $columnDirection)->select('teachers.*'); |
| 74 | 74 | }, |
| 75 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 76 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 75 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 76 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 77 | 77 | $q->where('firstname', 'like', '%'.$searchTerm.'%'); |
| 78 | 78 | }); |
| 79 | 79 | }, |
@@ -87,12 +87,12 @@ discard block |
||
| 87 | 87 | 'attribute' => 'email', // foreign key attribute that is shown to user |
| 88 | 88 | 'model' => 'App\Models\User', // foreign key model |
| 89 | 89 | 'orderable' => true, |
| 90 | - 'orderLogic' => function ($query, $column, $columnDirection) { |
|
| 90 | + 'orderLogic' => function($query, $column, $columnDirection) { |
|
| 91 | 91 | return $query->leftJoin('users', 'users.id', '=', 'teachers.id') |
| 92 | 92 | ->orderBy('users.email', $columnDirection)->select('teachers.*'); |
| 93 | 93 | }, |
| 94 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 95 | - $query->orWhereHas('user', function ($q) use ($searchTerm) { |
|
| 94 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 95 | + $query->orWhereHas('user', function($q) use ($searchTerm) { |
|
| 96 | 96 | $q->where('email', 'like', '%'.$searchTerm.'%'); |
| 97 | 97 | }); |
| 98 | 98 | }, |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | $username = $request->email; |
| 167 | 167 | } |
| 168 | 168 | else { |
| 169 | - $username = $this->generateUsername($request->firstname . ' ' . $request->lastname); |
|
| 169 | + $username = $this->generateUsername($request->firstname.' '.$request->lastname); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | $user = User::create([ |
@@ -191,11 +191,11 @@ discard block |
||
| 191 | 191 | $username_parts = array_filter(explode(" ", strtolower($fullName))); |
| 192 | 192 | $username_parts = array_slice($username_parts, -2); |
| 193 | 193 | |
| 194 | - $part1 = (!empty($username_parts[0]))?substr($username_parts[0], 0,3):""; |
|
| 195 | - $part2 = (!empty($username_parts[1]))?substr($username_parts[1], 0,8):""; |
|
| 194 | + $part1 = (!empty($username_parts[0])) ?substr($username_parts[0], 0, 3) : ""; |
|
| 195 | + $part2 = (!empty($username_parts[1])) ?substr($username_parts[1], 0, 8) : ""; |
|
| 196 | 196 | $part3 = rand(999, 9999); |
| 197 | 197 | |
| 198 | - $username = $part1. $part2. $part3; //str_shuffle to randomly shuffle all characters |
|
| 198 | + $username = $part1.$part2.$part3; //str_shuffle to randomly shuffle all characters |
|
| 199 | 199 | |
| 200 | 200 | return $username; |
| 201 | 201 | } |
@@ -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 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | protected function setupListOperation() |
| 34 | 34 | { |
| 35 | 35 | CRUD::setColumns([ |
| 36 | - [ // skill type |
|
| 36 | + [// skill type |
|
| 37 | 37 | 'label' => 'Type', // Table column heading |
| 38 | 38 | 'type' => 'select', |
| 39 | 39 | 'name' => 'skill_type', // the method that defines the relationship in your Model |
@@ -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', // Table column heading |
| 51 | 51 | 'type' => 'select', |
| 52 | 52 | 'name' => 'level', // the method that defines the relationship in your Model |
@@ -58,23 +58,23 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | CRUD::enableBulkActions(); |
| 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 | - ], function () { |
|
| 65 | + ], function() { |
|
| 66 | 66 | return Level::all()->pluck('name', 'id')->toArray(); |
| 67 | - }, function ($value) { // if the filter is active |
|
| 67 | + }, function($value) { // if the filter is active |
|
| 68 | 68 | CRUD::addClause('where', 'level_id', $value); |
| 69 | 69 | }); |
| 70 | 70 | |
| 71 | - CRUD::addFilter([ // select2 filter |
|
| 71 | + CRUD::addFilter([// select2 filter |
|
| 72 | 72 | 'name' => 'skill_type_id', |
| 73 | 73 | 'type' => 'select2', |
| 74 | 74 | 'label'=> 'Type', |
| 75 | - ], function () { |
|
| 75 | + ], function() { |
|
| 76 | 76 | return SkillType::all()->pluck('name', 'id')->toArray(); |
| 77 | - }, function ($value) { // if the filter is active |
|
| 77 | + }, function($value) { // if the filter is active |
|
| 78 | 78 | CRUD::addClause('where', 'skill_type_id', $value); |
| 79 | 79 | }); |
| 80 | 80 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | { |
| 84 | 84 | CRUD::setValidation(StoreRequest::class); |
| 85 | 85 | CRUD::addFields([ |
| 86 | - [ // skill type |
|
| 86 | + [// skill type |
|
| 87 | 87 | 'label' => 'Type', // Table column heading |
| 88 | 88 | 'type' => 'select', |
| 89 | 89 | 'name' => 'skill_type_id', // the db column for the foreign key |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | 'type' => 'text', |
| 97 | 97 | 'name' => 'name', |
| 98 | 98 | ], |
| 99 | - [ // skill level |
|
| 99 | + [// skill level |
|
| 100 | 100 | 'label' => 'Level', // Table column heading |
| 101 | 101 | 'type' => 'select', |
| 102 | 102 | 'name' => 'level_id', // the db column for the foreign key |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | 'type' => "relationship", |
| 110 | 110 | 'name' => 'skill_type', // the method on your model that defines the relationship |
| 111 | 111 | 'ajax' => true, |
| 112 | - 'inline_create' => [ // specify the entity in singular |
|
| 112 | + 'inline_create' => [// specify the entity in singular |
|
| 113 | 113 | 'entity' => 'skilltype', // the entity in singular |
| 114 | 114 | // OPTIONALS |
| 115 | 115 | 'force_select' => true, // should the inline-created entry be immediately selected? |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | public function setup() |
| 28 | 28 | { |
| 29 | 29 | CRUD::setModel(\App\Models\Config::class); |
| 30 | - CRUD::setRoute(config('backpack.base.route_prefix') . '/config'); |
|
| 30 | + CRUD::setRoute(config('backpack.base.route_prefix').'/config'); |
|
| 31 | 31 | CRUD::setEntityNameStrings('config', 'configs'); |
| 32 | 32 | } |
| 33 | 33 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | public function setup() |
| 33 | 33 | { |
| 34 | 34 | CRUD::setModel(\App\Models\Invoice::class); |
| 35 | - CRUD::setRoute(config('backpack.base.route_prefix') . '/invoice'); |
|
| 35 | + CRUD::setRoute(config('backpack.base.route_prefix').'/invoice'); |
|
| 36 | 36 | CRUD::setEntityNameStrings('invoice', 'invoices'); |
| 37 | 37 | $this->crud->addButtonFromView('top', 'createInvoice', 'createInvoice', 'start'); |
| 38 | 38 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | { |
| 102 | 102 | $invoice = Invoice::findOrFail($id)->load('payments'); |
| 103 | 103 | |
| 104 | - if (! backpack_user()->can('enrollments.edit')) { |
|
| 104 | + if (!backpack_user()->can('enrollments.edit')) { |
|
| 105 | 105 | abort(403); |
| 106 | 106 | } |
| 107 | 107 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $q->where('firstname', 'like', '%'.$searchTerm.'%') |
| 55 | 55 | ->orWhere('lastname', 'like', '%'.$searchTerm.'%') |
| 56 | 56 | ->orWhere('email', 'like', '%'.$searchTerm.'%') |
| 57 | - ->orWhere('idnumber', 'like', '%'.$searchTerm.'%'); |
|
| 57 | + ->orWhere('idnumber', 'like', '%'.$searchTerm.'%'); |
|
| 58 | 58 | }); |
| 59 | 59 | }); |
| 60 | 60 | }, |
@@ -88,10 +88,10 @@ discard block |
||
| 88 | 88 | 'name' => 'noresult', |
| 89 | 89 | 'label'=> __('No Result'), |
| 90 | 90 | ], |
| 91 | - false, |
|
| 92 | - function () { |
|
| 93 | - CRUD::addClause('noResult'); |
|
| 94 | - } |
|
| 91 | + false, |
|
| 92 | + function () { |
|
| 93 | + CRUD::addClause('noResult'); |
|
| 94 | + } |
|
| 95 | 95 | ); |
| 96 | 96 | |
| 97 | 97 | CRUD::addFilter( |
@@ -102,8 +102,8 @@ discard block |
||
| 102 | 102 | ], |
| 103 | 103 | false, |
| 104 | 104 | function () { |
| 105 | - CRUD::addClause('real'); |
|
| 106 | - } |
|
| 105 | + CRUD::addClause('real'); |
|
| 106 | + } |
|
| 107 | 107 | ); |
| 108 | 108 | |
| 109 | 109 | CRUD::addFilter([ |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | 'type' => 'select', |
| 49 | 49 | 'name' => 'student', // the method that defines the relationship in your Model |
| 50 | 50 | 'attribute' => 'name', // foreign key attribute that is shown to user |
| 51 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 52 | - $query->orWhereHas('student', function ($q) use ($searchTerm) { |
|
| 53 | - $q->WhereHas('user', function ($q) use ($searchTerm) { |
|
| 51 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 52 | + $query->orWhereHas('student', function($q) use ($searchTerm) { |
|
| 53 | + $q->WhereHas('user', function($q) use ($searchTerm) { |
|
| 54 | 54 | $q->where('firstname', 'like', '%'.$searchTerm.'%') |
| 55 | 55 | ->orWhere('lastname', 'like', '%'.$searchTerm.'%') |
| 56 | 56 | ->orWhere('email', 'like', '%'.$searchTerm.'%') |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | 'label'=> __('No Result'), |
| 90 | 90 | ], |
| 91 | 91 | false, |
| 92 | - function () { |
|
| 92 | + function() { |
|
| 93 | 93 | CRUD::addClause('noResult'); |
| 94 | 94 | } |
| 95 | 95 | ); |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | 'label'=> __('Hide Parents'), |
| 102 | 102 | ], |
| 103 | 103 | false, |
| 104 | - function () { |
|
| 104 | + function() { |
|
| 105 | 105 | CRUD::addClause('real'); |
| 106 | 106 | } |
| 107 | 107 | ); |
@@ -110,20 +110,20 @@ discard block |
||
| 110 | 110 | 'name' => 'period_id', |
| 111 | 111 | 'type' => 'select2', |
| 112 | 112 | 'label'=> __('Period'), |
| 113 | - ], function () { |
|
| 113 | + ], function() { |
|
| 114 | 114 | return Period::all()->pluck('name', 'id')->toArray(); |
| 115 | - }, function ($value) { // if the filter is active |
|
| 115 | + }, function($value) { // if the filter is active |
|
| 116 | 116 | CRUD::addClause('period', $value); |
| 117 | 117 | }); |
| 118 | 118 | |
| 119 | - CRUD::addFilter([ // select2_multiple filter |
|
| 119 | + CRUD::addFilter([// select2_multiple filter |
|
| 120 | 120 | 'name' => 'result', |
| 121 | 121 | 'type' => 'select2', |
| 122 | 122 | 'label'=> __('Result'), |
| 123 | - ], function () { // the options that show up in the select2 |
|
| 123 | + ], function() { // the options that show up in the select2 |
|
| 124 | 124 | return ResultType::all()->pluck('name', 'id')->toArray(); |
| 125 | - }, function ($value) { // if the filter is active |
|
| 126 | - $this->crud->query = $this->crud->query->whereHas('result', function ($query) use ($value) { |
|
| 125 | + }, function($value) { // if the filter is active |
|
| 126 | + $this->crud->query = $this->crud->query->whereHas('result', function($query) use ($value) { |
|
| 127 | 127 | $query->where('result_type_id', $value); |
| 128 | 128 | }); |
| 129 | 129 | }); |