@@ -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); |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | public function updateCourse(Course $course): void |
| 135 | 135 | { |
| 136 | - if (! $course->lms_id) { |
|
| 136 | + if (!$course->lms_id) { |
|
| 137 | 137 | $this->createCourse($course); |
| 138 | 138 | } |
| 139 | 139 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | Log::info('found these teachers IDs on LMS:'.implode(', ', $teachers->pluck('id')->toArray())); |
| 163 | 163 | |
| 164 | 164 | // if the course has no teacher, stop |
| 165 | - if (! $course->teacher) { |
|
| 165 | + if (!$course->teacher) { |
|
| 166 | 166 | Log::alert('The course has no teacher on local system, removing all teachers from remote'); |
| 167 | 167 | foreach ($teachers as $teacher) { |
| 168 | 168 | $this->removeTeacher($course->lms_id, $teacher['id']); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - if (! $course->teacher->user->lms_id || ! $teachers->contains('id', $course->teacher->user->lms_id)) { |
|
| 180 | + if (!$course->teacher->user->lms_id || !$teachers->contains('id', $course->teacher->user->lms_id)) { |
|
| 181 | 181 | Log::info('the course teacher has changed, need to update it'); |
| 182 | 182 | $this->addTeacher($course); |
| 183 | 183 | } |
@@ -187,14 +187,14 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | public function enrollStudent(Course $course, Student $student): void |
| 189 | 189 | { |
| 190 | - if (! $course->lms_id) { |
|
| 190 | + if (!$course->lms_id) { |
|
| 191 | 191 | abort(404, 'This course is not synced with external LMS'); |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | $courseId = $course->lms_id; |
| 195 | 195 | |
| 196 | 196 | // if the student is not synced with the LMS, create them |
| 197 | - if (! $student->user->lms_id) { |
|
| 197 | + if (!$student->user->lms_id) { |
|
| 198 | 198 | $this->createUser($student->user); |
| 199 | 199 | } |
| 200 | 200 | |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | // only process if the course has a teacher |
| 218 | 218 | if ($course->teacher_id) { |
| 219 | 219 | // if the teacher doesn't exist on LMS, create them |
| 220 | - if (! $course->teacher->user->lms_id) { |
|
| 220 | + if (!$course->teacher->user->lms_id) { |
|
| 221 | 221 | Log::info('creating user now'); |
| 222 | 222 | $this->createUser($course->teacher->user); |
| 223 | 223 | } |
@@ -39,22 +39,22 @@ discard block |
||
| 39 | 39 | /** attributes */ |
| 40 | 40 | public function getFirstnameAttribute(): ?string |
| 41 | 41 | { |
| 42 | - return $this?->user?->firstname; |
|
| 42 | + return $this ? ->user ? ->firstname; |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | public function getLastnameAttribute(): ?string |
| 46 | 46 | { |
| 47 | - return $this?->user?->lastname; |
|
| 47 | + return $this ? ->user ? ->lastname; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public function getEmailAttribute(): ?string |
| 51 | 51 | { |
| 52 | - return $this?->user?->email; |
|
| 52 | + return $this ? ->user ? ->email; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | public function getNameAttribute(): ?string |
| 56 | 56 | { |
| 57 | - return $this?->user?->firstname.' '.$this?->user?->lastname; |
|
| 57 | + return $this ? ->user ? ->firstname.' '.$this ? ->user ? ->lastname; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | public function period_courses(Period $period) |
@@ -178,14 +178,14 @@ discard block |
||
| 178 | 178 | $eventsWithMissingAttendance = []; |
| 179 | 179 | |
| 180 | 180 | $eventsWithExpectedAttendance = $this->events() |
| 181 | - ->where(function ($query) { |
|
| 181 | + ->where(function($query) { |
|
| 182 | 182 | $query->where('exempt_attendance', '!=', true); |
| 183 | 183 | $query->where('exempt_attendance', '!=', 1); |
| 184 | 184 | $query->orWhereNull('exempt_attendance'); |
| 185 | 185 | }) |
| 186 | 186 | ->where('course_id', '!=', null) |
| 187 | - ->whereHas('course', fn (Builder $query) => $query->where('period_id', $period->id) |
|
| 188 | - ->where(function ($query) { |
|
| 187 | + ->whereHas('course', fn(Builder $query) => $query->where('period_id', $period->id) |
|
| 188 | + ->where(function($query) { |
|
| 189 | 189 | $query->where('exempt_attendance', '!=', true); |
| 190 | 190 | $query->where('exempt_attendance', '!=', 1); |
| 191 | 191 | $query->orWhereNull('exempt_attendance'); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | public function scopeStatus(Builder $query, $status) |
| 33 | 33 | { |
| 34 | - return match ($status) { |
|
| 34 | + return match($status) { |
|
| 35 | 35 | '2' => $query->where('status', 2), |
| 36 | 36 | '1' => $query->where('status', 1), |
| 37 | 37 | default => $query, |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | public function invoices() |
| 69 | 69 | { |
| 70 | - return $this->invoiceDetails->map(fn (InvoiceDetail $invoiceDetail) => $invoiceDetail->invoice)->filter(); |
|
| 70 | + return $this->invoiceDetails->map(fn(InvoiceDetail $invoiceDetail) => $invoiceDetail->invoice)->filter(); |
|
| 71 | 71 | } |
| 72 | 72 | /* |
| 73 | 73 | |-------------------------------------------------------------------------- |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | public function getStatusTypeNameAttribute() |
| 125 | 125 | { |
| 126 | - return match ($this->status) { |
|
| 126 | + return match($this->status) { |
|
| 127 | 127 | 2 => __('Paid'), |
| 128 | 128 | 1 => __('Pending'), |
| 129 | 129 | default => '-', |
@@ -60,11 +60,11 @@ discard block |
||
| 60 | 60 | public function scopeWithoutChildren($query) |
| 61 | 61 | { |
| 62 | 62 | return $query |
| 63 | - ->where(function ($query) { |
|
| 63 | + ->where(function($query) { |
|
| 64 | 64 | $query->whereDoesntHave('childrenEnrollments') |
| 65 | 65 | ->where('parent_id', null); |
| 66 | 66 | }) |
| 67 | - ->orWhere(function ($query) { |
|
| 67 | + ->orWhere(function($query) { |
|
| 68 | 68 | $query->where('parent_id', null); |
| 69 | 69 | }) |
| 70 | 70 | ->get(); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | public function scopePeriod(Builder $query, int $periodId) |
| 88 | 88 | { |
| 89 | - return $query->whereHas('course', function ($q) use ($periodId) { |
|
| 89 | + return $query->whereHas('course', function($q) use ($periodId) { |
|
| 90 | 90 | $q->where('period_id', $periodId); |
| 91 | 91 | }); |
| 92 | 92 | } |
@@ -174,13 +174,13 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | public function invoices() |
| 176 | 176 | { |
| 177 | - return $this->invoiceDetails->map(fn (InvoiceDetail $invoiceDetail) => $invoiceDetail->invoice)->filter(); |
|
| 177 | + return $this->invoiceDetails->map(fn(InvoiceDetail $invoiceDetail) => $invoiceDetail->invoice)->filter(); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | // also includes invoices for this enrollment's scheduled payments. |
| 181 | 181 | public function relatedInvoices() |
| 182 | 182 | { |
| 183 | - $scheduledPaymentsInvoices = $this->scheduledPayments->map(fn (ScheduledPayment $scheduledPayment) => $scheduledPayment->invoices()); |
|
| 183 | + $scheduledPaymentsInvoices = $this->scheduledPayments->map(fn(ScheduledPayment $scheduledPayment) => $scheduledPayment->invoices()); |
|
| 184 | 184 | |
| 185 | 185 | return $this->invoices()->concat($scheduledPaymentsInvoices)->flatten(1); |
| 186 | 186 | } |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | // if enabled, retrieve the default price category for the student |
| 339 | - if (config('invoicing.price_categories_enabled') && $this->student?->price_category) { |
|
| 339 | + if (config('invoicing.price_categories_enabled') && $this->student ? ->price_category) { |
|
| 340 | 340 | $price_category = $this->student->price_category; |
| 341 | 341 | |
| 342 | 342 | return $this->course->$price_category ?? 0; |
@@ -366,11 +366,11 @@ discard block |
||
| 366 | 366 | |
| 367 | 367 | // delete attendance records related to the enrollment |
| 368 | 368 | $attendances = $this->course->attendance->where('student_id', $this->student->id); |
| 369 | - Attendance::destroy($attendances->map(fn ($item, $key) => $item->id)); |
|
| 369 | + Attendance::destroy($attendances->map(fn($item, $key) => $item->id)); |
|
| 370 | 370 | |
| 371 | 371 | foreach ($this->course->children as $child) { |
| 372 | 372 | $attendances = $child->attendance->where('student_id', $this->student->id); |
| 373 | - Attendance::destroy($attendances->map(fn ($item, $key) => $item->id)); |
|
| 373 | + Attendance::destroy($attendances->map(fn($item, $key) => $item->id)); |
|
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | $this->delete(); |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | // if one book is expired |
| 404 | - if ($this->student && $this->student->books->where('id', $book->id)->filter(fn ($book) => $book->pivot->expiry_date == null || $book->pivot->expiry_date > Carbon::now())->count() == 0) { |
|
| 404 | + if ($this->student && $this->student->books->where('id', $book->id)->filter(fn($book) => $book->pivot->expiry_date == null || $book->pivot->expiry_date > Carbon::now())->count() == 0) { |
|
| 405 | 405 | return 'EXP'; |
| 406 | 406 | } |
| 407 | 407 | } |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | |
| 413 | 413 | public function getBalanceAttribute() |
| 414 | 414 | { |
| 415 | - if (! config('invoicing.invoices_contain_enrollments_only')) { |
|
| 415 | + if (!config('invoicing.invoices_contain_enrollments_only')) { |
|
| 416 | 416 | abort(422, 'Configuration options forbid to access this value'); |
| 417 | 417 | } |
| 418 | 418 | |
@@ -349,8 +349,8 @@ discard block |
||
| 349 | 349 | |
| 350 | 350 | public function handle() |
| 351 | 351 | { |
| 352 | - Student::whereNull('gender_id')->chunkById(10, function ($students) { |
|
| 353 | - $query = $students->map(fn ($student) => ['id' => $student->id, |
|
| 352 | + Student::whereNull('gender_id')->chunkById(10, function($students) { |
|
| 353 | + $query = $students->map(fn($student) => ['id' => $student->id, |
|
| 354 | 354 | 'name' => $this->remove_accents(strtok($student->firstname, ' ')), ]); |
| 355 | 355 | |
| 356 | 356 | $response = Http::get('https://api.genderize.io/?name[]='.$query->pluck('name')->implode('&name[]=')); |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | $firstname = $query->firstWhere('id', $student->id)['name']; |
| 359 | 359 | |
| 360 | 360 | $student->update([ |
| 361 | - 'gender_id' => match ($response->collect()->where('name', $firstname)->where('probability', '>', 0.9)->where('count', '>', 10)->first()['gender'] ?? '-') { |
|
| 361 | + 'gender_id' => match($response->collect()->where('name', $firstname)->where('probability', '>', 0.9)->where('count', '>', 10)->first()['gender'] ?? '-') { |
|
| 362 | 362 | 'male' => 2, |
| 363 | 363 | 'female' => 1, |
| 364 | 364 | default => null, |