@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | ->where('end', '<', Carbon::now()->addDays(90)) |
| 26 | 26 | ->orderBy('id', 'desc') |
| 27 | 27 | ->get() |
| 28 | - ->map(fn ($event) => [ |
|
| 28 | + ->map(fn($event) => [ |
|
| 29 | 29 | 'title' => $event->name, |
| 30 | 30 | 'resourceId' => $event->room_id, |
| 31 | 31 | 'start' => $event->start, |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | $rooms = Room::all()->toArray(); |
| 39 | 39 | |
| 40 | - $rooms = array_map(fn ($room) => [ |
|
| 40 | + $rooms = array_map(fn($room) => [ |
|
| 41 | 41 | 'id' => $room['id'], |
| 42 | 42 | 'title' => $room['name'], |
| 43 | 43 | ], $rooms); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $unassigned_events = Event::with('course') |
| 48 | 48 | ->whereNull('room_id') |
| 49 | 49 | ->get() |
| 50 | - ->map(fn ($event) => [ |
|
| 50 | + ->map(fn($event) => [ |
|
| 51 | 51 | 'title' => $event->name, |
| 52 | 52 | 'resourceId' => 'tbd', |
| 53 | 53 | 'start' => $event->start, |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | public function show(Room $room) |
| 71 | 71 | { |
| 72 | 72 | $events = $room->events->toArray(); |
| 73 | - $events = array_map(fn ($event) => [ |
|
| 73 | + $events = array_map(fn($event) => [ |
|
| 74 | 74 | 'title' => $event['name'], |
| 75 | 75 | 'start' => $event['start'], |
| 76 | 76 | 'end' => $event['end'], |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | public function scopeEnrolled($query) |
| 44 | 44 | { |
| 45 | - return $query->whereHas('enrollments', function ($q) { |
|
| 46 | - return $q->whereHas('course', function ($q) { |
|
| 45 | + return $query->whereHas('enrollments', function($q) { |
|
| 46 | + return $q->whereHas('course', function($q) { |
|
| 47 | 47 | return $q->where('period_id', Period::get_default_period()->id); |
| 48 | 48 | }); |
| 49 | 49 | }); |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | public function scopeComputedLeadType($query, $leadTypeId) |
| 53 | 53 | { |
| 54 | - return match ($leadTypeId) { |
|
| 55 | - 1 => $query->whereHas('enrollments', fn ($query) => $query->whereHas('course', function ($q) { |
|
| 54 | + return match($leadTypeId) { |
|
| 55 | + 1 => $query->whereHas('enrollments', fn($query) => $query->whereHas('course', function($q) { |
|
| 56 | 56 | $q->where('period_id', Period::get_default_period()->id); |
| 57 | 57 | })), |
| 58 | 58 | |
@@ -60,15 +60,15 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | 4 => $query |
| 62 | 62 | ->where('lead_type_id', $leadTypeId) |
| 63 | - ->orWhere(function ($query) { |
|
| 63 | + ->orWhere(function($query) { |
|
| 64 | 64 | $query |
| 65 | 65 | ->whereNull('lead_type_id') |
| 66 | - ->whereHas('enrollments', fn ($query) => $query |
|
| 67 | - ->whereHas('course', function ($q) { |
|
| 66 | + ->whereHas('enrollments', fn($query) => $query |
|
| 67 | + ->whereHas('course', function($q) { |
|
| 68 | 68 | $q->where('period_id', '!=', Period::get_default_period()->id); |
| 69 | 69 | })) |
| 70 | - ->whereDoesntHave('enrollments', fn ($query) => $query |
|
| 71 | - ->whereHas('course', function ($q) { |
|
| 70 | + ->whereDoesntHave('enrollments', fn($query) => $query |
|
| 71 | + ->whereHas('course', function($q) { |
|
| 72 | 72 | $q->where('period_id', Period::get_default_period()->id); |
| 73 | 73 | })); |
| 74 | 74 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | return $this->hasMany(Attendance::class) |
| 111 | 111 | ->where('attendance_type_id', 4) // absence |
| 112 | - ->whereHas('event', fn ($q) => $q->whereHas('course', fn ($c) => $c->where('period_id', $period->id))); |
|
| 112 | + ->whereHas('event', fn($q) => $q->whereHas('course', fn($c) => $c->where('period_id', $period->id))); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | public function periodAttendance(Period $period = null) |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | return $this->hasMany(Attendance::class) |
| 122 | - ->whereHas('event', fn ($q) => $q->whereHas('course', fn ($c) => $c->where('period_id', $period->id))); |
|
| 122 | + ->whereHas('event', fn($q) => $q->whereHas('course', fn($c) => $c->where('period_id', $period->id))); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | public function contacts() |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | public function getEmailAttribute(): ?string |
| 182 | 182 | { |
| 183 | - return $this?->user?->email; |
|
| 183 | + return $this ? ->user ? ->email; |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | public function getNameAttribute(): string |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | public function getStudentAgeAttribute() |
| 192 | 192 | { |
| 193 | - return $this->birthdate ? Carbon::parse($this->birthdate)->age . ' ' . __('years old') : ''; |
|
| 193 | + return $this->birthdate ? Carbon::parse($this->birthdate)->age.' '.__('years old') : ''; |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | public function getStudentBirthdateAttribute() |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | public function getIsEnrolledAttribute() |
| 202 | 202 | { |
| 203 | 203 | // if the student is currently enrolled |
| 204 | - if ($this->enrollments()->whereHas('course', fn ($q) => $q->where('period_id', Period::get_default_period()->id))->count() > 0) { |
|
| 204 | + if ($this->enrollments()->whereHas('course', fn($q) => $q->where('period_id', Period::get_default_period()->id))->count() > 0) { |
|
| 205 | 205 | return 1; |
| 206 | 206 | } |
| 207 | 207 | |
@@ -296,13 +296,13 @@ discard block |
||
| 296 | 296 | |
| 297 | 297 | public function getImageAttribute(): ?string |
| 298 | 298 | { |
| 299 | - return $this->getMedia('profile-picture')->last()?->getUrl('thumb'); |
|
| 299 | + return $this->getMedia('profile-picture')->last() ? ->getUrl('thumb'); |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | public function setImageAttribute($value) |
| 303 | 303 | { |
| 304 | 304 | // if the image was erased |
| 305 | - if ($value==null) { |
|
| 305 | + if ($value == null) { |
|
| 306 | 306 | $this->clearMediaCollection('profile-picture'); |
| 307 | 307 | } |
| 308 | 308 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | 'name' => 'id', |
| 107 | 107 | 'label' => 'ID', |
| 108 | 108 | 'wrapper' => [ |
| 109 | - 'element' => function ($crud, $column, $entry) { |
|
| 109 | + 'element' => function($crud, $column, $entry) { |
|
| 110 | 110 | return $entry->status_id > 2 ? 'del' : 'span'; |
| 111 | 111 | }, |
| 112 | 112 | ], |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | 'type' => 'text', |
| 118 | 118 | 'name' => 'student.idnumber', |
| 119 | 119 | 'wrapper' => [ |
| 120 | - 'element' => function ($crud, $column, $entry) { |
|
| 120 | + 'element' => function($crud, $column, $entry) { |
|
| 121 | 121 | return $entry->status_id > 2 ? 'del' : 'span'; |
| 122 | 122 | }, |
| 123 | 123 | ], |
@@ -130,13 +130,13 @@ discard block |
||
| 130 | 130 | 'label' => __('Last Name'), |
| 131 | 131 | 'type' => 'relationship', |
| 132 | 132 | 'wrapper' => [ |
| 133 | - 'element' => function ($crud, $column, $entry) { |
|
| 133 | + 'element' => function($crud, $column, $entry) { |
|
| 134 | 134 | return $entry->status_id > 2 ? 'del' : 'span'; |
| 135 | 135 | }, |
| 136 | 136 | ], |
| 137 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 138 | - $query->orWhereHas('student', function ($q) use ($searchTerm) { |
|
| 139 | - $q->whereHas('user', function ($q) use ($searchTerm) { |
|
| 137 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 138 | + $query->orWhereHas('student', function($q) use ($searchTerm) { |
|
| 139 | + $q->whereHas('user', function($q) use ($searchTerm) { |
|
| 140 | 140 | $q->where('lastname', 'like', '%'.$searchTerm.'%'); |
| 141 | 141 | }); |
| 142 | 142 | }); |
@@ -150,13 +150,13 @@ discard block |
||
| 150 | 150 | 'label' => __('First Name'), |
| 151 | 151 | 'type' => 'relationship', |
| 152 | 152 | 'wrapper' => [ |
| 153 | - 'element' => function ($crud, $column, $entry) { |
|
| 153 | + 'element' => function($crud, $column, $entry) { |
|
| 154 | 154 | return $entry->status_id > 2 ? 'del' : 'span'; |
| 155 | 155 | }, |
| 156 | 156 | ], |
| 157 | - 'searchLogic' => function ($query, $column, $searchTerm) { |
|
| 158 | - $query->orWhereHas('student', function ($q) use ($searchTerm) { |
|
| 159 | - $q->whereHas('user', function ($q) use ($searchTerm) { |
|
| 157 | + 'searchLogic' => function($query, $column, $searchTerm) { |
|
| 158 | + $query->orWhereHas('student', function($q) use ($searchTerm) { |
|
| 159 | + $q->whereHas('user', function($q) use ($searchTerm) { |
|
| 160 | 160 | $q->where('firstname', 'like', '%'.$searchTerm.'%'); |
| 161 | 161 | }); |
| 162 | 162 | }); |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | 'model' => EnrollmentStatusType::class, |
| 203 | 203 | 'wrapper' => [ |
| 204 | 204 | 'element' => 'span', |
| 205 | - 'class' => function ($crud, $column, $entry) { |
|
| 205 | + 'class' => function($crud, $column, $entry) { |
|
| 206 | 206 | return 'badge badge-pill badge-'.$entry->enrollmentStatus->styling(); |
| 207 | 207 | }, |
| 208 | 208 | ], |
@@ -255,8 +255,8 @@ discard block |
||
| 255 | 255 | 'name' => 'status_id', |
| 256 | 256 | 'type' => 'select2_multiple', |
| 257 | 257 | 'label'=> __('Status'), |
| 258 | - ], fn () => EnrollmentStatusType::all()->pluck('name', 'id')->toArray(), |
|
| 259 | - function ($values) { |
|
| 258 | + ], fn() => EnrollmentStatusType::all()->pluck('name', 'id')->toArray(), |
|
| 259 | + function($values) { |
|
| 260 | 260 | foreach (json_decode($values, null, 512, JSON_THROW_ON_ERROR) as $value) { |
| 261 | 261 | CRUD::addClause('orWhere', 'status_id', $value); |
| 262 | 262 | } |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | 'name' => 'period_id', |
| 267 | 267 | 'type' => 'select2', |
| 268 | 268 | 'label'=> __('Period'), |
| 269 | - ], fn () => Period::all()->pluck('name', 'id')->toArray(), function ($value) { |
|
| 269 | + ], fn() => Period::all()->pluck('name', 'id')->toArray(), function($value) { |
|
| 270 | 270 | CRUD::addClause('period', $value); |
| 271 | 271 | }); |
| 272 | 272 | |
@@ -276,12 +276,12 @@ discard block |
||
| 276 | 276 | 'type' => 'select2', |
| 277 | 277 | 'label'=> __('Scholarship'), |
| 278 | 278 | ], |
| 279 | - fn () => Scholarship::all()->pluck('name', 'id')->toArray(), |
|
| 280 | - function ($value) { // if the filter is active |
|
| 279 | + fn() => Scholarship::all()->pluck('name', 'id')->toArray(), |
|
| 280 | + function($value) { // if the filter is active |
|
| 281 | 281 | if ($value == 'all') { |
| 282 | 282 | CRUD::addClause('whereHas', 'scholarships'); |
| 283 | 283 | } else { |
| 284 | - CRUD::addClause('whereHas', 'scholarships', function ($q) use ($value) { |
|
| 284 | + CRUD::addClause('whereHas', 'scholarships', function($q) use ($value) { |
|
| 285 | 285 | $q->where('scholarships.id', $value); |
| 286 | 286 | }); |
| 287 | 287 | } |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | ->get(); |
| 302 | 302 | |
| 303 | 303 | // get related comments |
| 304 | - $comments = $enrollment->invoices->map(fn (Invoice $invoice) => $invoice->comments)->flatten()->concat($enrollment->comments); |
|
| 304 | + $comments = $enrollment->invoices->map(fn(Invoice $invoice) => $invoice->comments)->flatten()->concat($enrollment->comments); |
|
| 305 | 305 | |
| 306 | 306 | $scholarships = Scholarship::all(); |
| 307 | 307 | |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | 'model' => \App\Models\Course::class, |
| 333 | 333 | 'attribute' => 'name', |
| 334 | 334 | |
| 335 | - 'options' => (fn ($query) => $query->orderBy('level_id', 'ASC')->where('period_id', $this->crud->getCurrentEntry()->course->period_id)->get()), |
|
| 335 | + 'options' => (fn($query) => $query->orderBy('level_id', 'ASC')->where('period_id', $this->crud->getCurrentEntry()->course->period_id)->get()), |
|
| 336 | 336 | ]); |
| 337 | 337 | |
| 338 | 338 | CRUD::addField(array_merge([ |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | 'label' => trans('backpack::permissionmanager.email'), |
| 49 | 49 | 'type' => 'email', |
| 50 | 50 | ], |
| 51 | - [ // n-n relationship (with pivot table) |
|
| 51 | + [// n-n relationship (with pivot table) |
|
| 52 | 52 | 'label' => trans('backpack::permissionmanager.roles'), |
| 53 | 53 | 'type' => 'select_multiple', |
| 54 | 54 | 'name' => 'roles', |
@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | 'label' => trans('backpack::permissionmanager.role'), |
| 68 | 68 | ], |
| 69 | 69 | config('permission.models.role')::all()->pluck(['name', 'id'])->toArray(), |
| 70 | - function ($value) { |
|
| 70 | + function($value) { |
|
| 71 | 71 | // if the filter is active |
| 72 | - $this->crud->addClause('whereHas', 'roles', function ($query) use ($value) { |
|
| 72 | + $this->crud->addClause('whereHas', 'roles', function($query) use ($value) { |
|
| 73 | 73 | $query->where('role_id', '=', $value); |
| 74 | 74 | }); |
| 75 | 75 | } |
@@ -120,12 +120,12 @@ discard block |
||
| 120 | 120 | protected function addFields() |
| 121 | 121 | { |
| 122 | 122 | $this->crud->addFields([ |
| 123 | - [ // Select2 |
|
| 123 | + [// Select2 |
|
| 124 | 124 | 'label' => trans('firstname'), |
| 125 | 125 | 'type' => 'text', |
| 126 | 126 | 'name' => 'firstname', |
| 127 | 127 | ], |
| 128 | - [ // Select2 |
|
| 128 | + [// Select2 |
|
| 129 | 129 | 'label' => trans('lastname'), |
| 130 | 130 | 'type' => 'text', |
| 131 | 131 | 'name' => 'lastname', |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | protected function setupListOperation() |
| 32 | 32 | { |
| 33 | 33 | CRUD::setColumns([ |
| 34 | - [ // skill type |
|
| 34 | + [// skill type |
|
| 35 | 35 | 'label' => 'Type', |
| 36 | 36 | 'type' => 'select', |
| 37 | 37 | 'name' => 'skill_type', |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | 'type' => 'text', |
| 45 | 45 | 'name' => 'name', |
| 46 | 46 | ], |
| 47 | - [ // skill level |
|
| 47 | + [// skill level |
|
| 48 | 48 | 'label' => 'Level', |
| 49 | 49 | 'type' => 'select', |
| 50 | 50 | 'name' => 'level', |
@@ -56,19 +56,19 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | CRUD::enableExportButtons(); |
| 58 | 58 | |
| 59 | - CRUD::addFilter([ // select2 filter |
|
| 59 | + CRUD::addFilter([// select2 filter |
|
| 60 | 60 | 'name' => 'level_id', |
| 61 | 61 | 'type' => 'select2', |
| 62 | 62 | 'label'=> 'Level', |
| 63 | - ], fn () => Level::all()->pluck('name', 'id')->toArray(), function ($value) { // if the filter is active |
|
| 63 | + ], fn() => Level::all()->pluck('name', 'id')->toArray(), 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 | - ], fn () => SkillType::all()->pluck('name', 'id')->toArray(), function ($value) { // if the filter is active |
|
| 71 | + ], fn() => SkillType::all()->pluck('name', 'id')->toArray(), function($value) { // if the filter is active |
|
| 72 | 72 | CRUD::addClause('where', 'skill_type_id', $value); |
| 73 | 73 | }); |
| 74 | 74 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | { |
| 78 | 78 | CRUD::setValidation(StoreRequest::class); |
| 79 | 79 | CRUD::addFields([ |
| 80 | - [ // skill type |
|
| 80 | + [// skill type |
|
| 81 | 81 | 'label' => 'Type', |
| 82 | 82 | 'type' => 'select', |
| 83 | 83 | 'name' => 'skill_type_id', // the db column for the foreign key |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | 'type' => 'text', |
| 91 | 91 | 'name' => 'name', |
| 92 | 92 | ], |
| 93 | - [ // skill level |
|
| 93 | + [// skill level |
|
| 94 | 94 | 'label' => 'Level', |
| 95 | 95 | 'type' => 'select', |
| 96 | 96 | 'name' => 'level_id', // the db column for the foreign key |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | 'type' => 'relationship', |
| 104 | 104 | 'name' => 'skill_type', // the method on your model that defines the relationship |
| 105 | 105 | 'ajax' => true, |
| 106 | - 'inline_create' => [ // specify the entity in singular |
|
| 106 | + 'inline_create' => [// specify the entity in singular |
|
| 107 | 107 | 'entity' => 'skilltype', // the entity in singular |
| 108 | 108 | // OPTIONALS |
| 109 | 109 | 'force_select' => true, // should the inline-created entry be immediately selected? |
@@ -46,10 +46,10 @@ discard block |
||
| 46 | 46 | 'attribute' => 'lastname', |
| 47 | 47 | 'model' => \App\Models\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' => \App\Models\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' => \App\Models\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 |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | { |
| 35 | 35 | CRUD::addField(['name' => 'name', 'label' => 'Name', 'type' => 'text']); |
| 36 | 36 | |
| 37 | - CRUD::addField([ // Select2Multiple = n-n relationship (with pivot table) |
|
| 37 | + CRUD::addField([// Select2Multiple = n-n relationship (with pivot table) |
|
| 38 | 38 | 'label' => __('Grade Types'), |
| 39 | 39 | 'type' => 'select2_multiple', |
| 40 | 40 | 'name' => 'gradeTypes', |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | 'select_all' => true, // show Select All and Clear buttons? |
| 48 | 48 | ]); |
| 49 | 49 | |
| 50 | - CRUD::addField([ // Select2Multiple = n-n relationship (with pivot table) |
|
| 50 | + CRUD::addField([// Select2Multiple = n-n relationship (with pivot table) |
|
| 51 | 51 | 'label' => __('Skills'), |
| 52 | 52 | 'type' => 'select2_multiple', |
| 53 | 53 | 'name' => 'skills', |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | public function skills() |
| 202 | 202 | { |
| 203 | - return $this->evaluationType?->skills()->orderBy('order'); |
|
| 203 | + return $this->evaluationType ? ->skills()->orderBy('order'); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | public function books() |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | */ |
| 226 | 226 | public function getPendingAttendanceAttribute() |
| 227 | 227 | { |
| 228 | - $events = Event::where(function ($query) { |
|
| 228 | + $events = Event::where(function($query) { |
|
| 229 | 229 | $query->where('course_id', $this->id); |
| 230 | 230 | $query->where('exempt_attendance', '!=', true); |
| 231 | 231 | $query->where('exempt_attendance', '!=', 1); |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | foreach ($courseTimes as $courseTime) { |
| 359 | 359 | $initial = $daysInitials[$courseTime->day]; |
| 360 | 360 | |
| 361 | - if (! isset($parsedCourseTimes[$initial])) { |
|
| 361 | + if (!isset($parsedCourseTimes[$initial])) { |
|
| 362 | 362 | $parsedCourseTimes[$initial] = []; |
| 363 | 363 | } |
| 364 | 364 | |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | public function getCourseTeacherNameAttribute() |
| 406 | 406 | { |
| 407 | 407 | if ($this->teacher_id) { |
| 408 | - return $this->teacher?->name; |
|
| 408 | + return $this->teacher ? ->name; |
|
| 409 | 409 | } else { |
| 410 | 410 | return '-'; |
| 411 | 411 | } |
@@ -438,11 +438,11 @@ discard block |
||
| 438 | 438 | |
| 439 | 439 | public function getAcceptsNewStudentsAttribute(): bool |
| 440 | 440 | { |
| 441 | - if (! $this->spots || $this->spots == 0) { |
|
| 441 | + if (!$this->spots || $this->spots == 0) { |
|
| 442 | 442 | return true; |
| 443 | 443 | } |
| 444 | 444 | |
| 445 | - return $this->spots - $this->enrollments()->whereIn('status_id', [1,2])->count() > 0; |
|
| 445 | + return $this->spots - $this->enrollments()->whereIn('status_id', [1, 2])->count() > 0; |
|
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | public function getTakesAttendanceAttribute(): bool |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | |
| 462 | 462 | public function eventsWithExpectedAttendance() |
| 463 | 463 | { |
| 464 | - return $this->events()->where(function ($query) { |
|
| 464 | + return $this->events()->where(function($query) { |
|
| 465 | 465 | $query->where('exempt_attendance', '!=', true); |
| 466 | 466 | $query->where('exempt_attendance', '!=', 1); |
| 467 | 467 | $query->orWhereNull('exempt_attendance'); |