@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | protected $description = 'Guess gender for existing students, based on their firstname'; |
| 14 | 14 | |
| 15 | 15 | // wordpress implementation, from https://github.com/WordPress/WordPress/blob/a2693fd8602e3263b5925b9d799ddd577202167d/wp-includes/formatting.php#L1528 |
| 16 | - private function remove_accents( $string ) { |
|
| 16 | + private function remove_accents($string) { |
|
| 17 | 17 | |
| 18 | 18 | $chars = array( |
| 19 | 19 | // Decompositions for Latin-1 Supplement |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | 'À' => 'A', 'Á' => 'A', |
| 22 | 22 | 'Â' => 'A', 'Ã' => 'A', |
| 23 | 23 | 'Ä' => 'A', 'Å' => 'A', |
| 24 | - 'Æ' => 'AE','Ç' => 'C', |
|
| 24 | + 'Æ' => 'AE', 'Ç' => 'C', |
|
| 25 | 25 | 'È' => 'E', 'É' => 'E', |
| 26 | 26 | 'Ê' => 'E', 'Ë' => 'E', |
| 27 | 27 | 'Ì' => 'I', 'Í' => 'I', |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | 'Ö' => 'O', 'Ù' => 'U', |
| 33 | 33 | 'Ú' => 'U', 'Û' => 'U', |
| 34 | 34 | 'Ü' => 'U', 'Ý' => 'Y', |
| 35 | - 'Þ' => 'TH','ß' => 's', |
|
| 35 | + 'Þ' => 'TH', 'ß' => 's', |
|
| 36 | 36 | 'à' => 'a', 'á' => 'a', |
| 37 | 37 | 'â' => 'a', 'ã' => 'a', |
| 38 | 38 | 'ä' => 'a', 'å' => 'a', |
| 39 | - 'æ' => 'ae','ç' => 'c', |
|
| 39 | + 'æ' => 'ae', 'ç' => 'c', |
|
| 40 | 40 | 'è' => 'e', 'é' => 'e', |
| 41 | 41 | 'ê' => 'e', 'ë' => 'e', |
| 42 | 42 | 'ì' => 'i', 'í' => 'i', |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | 'Ĭ' => 'I', 'ĭ' => 'i', |
| 76 | 76 | 'Į' => 'I', 'į' => 'i', |
| 77 | 77 | 'İ' => 'I', 'ı' => 'i', |
| 78 | - 'IJ' => 'IJ','ij' => 'ij', |
|
| 78 | + 'IJ' => 'IJ', 'ij' => 'ij', |
|
| 79 | 79 | 'Ĵ' => 'J', 'ĵ' => 'j', |
| 80 | 80 | 'Ķ' => 'K', 'ķ' => 'k', |
| 81 | 81 | 'ĸ' => 'k', 'Ĺ' => 'L', |
@@ -91,13 +91,13 @@ discard block |
||
| 91 | 91 | 'Ō' => 'O', 'ō' => 'o', |
| 92 | 92 | 'Ŏ' => 'O', 'ŏ' => 'o', |
| 93 | 93 | 'Ő' => 'O', 'ő' => 'o', |
| 94 | - 'Œ' => 'OE','œ' => 'oe', |
|
| 95 | - 'Ŕ' => 'R','ŕ' => 'r', |
|
| 96 | - 'Ŗ' => 'R','ŗ' => 'r', |
|
| 97 | - 'Ř' => 'R','ř' => 'r', |
|
| 98 | - 'Ś' => 'S','ś' => 's', |
|
| 99 | - 'Ŝ' => 'S','ŝ' => 's', |
|
| 100 | - 'Ş' => 'S','ş' => 's', |
|
| 94 | + 'Œ' => 'OE', 'œ' => 'oe', |
|
| 95 | + 'Ŕ' => 'R', 'ŕ' => 'r', |
|
| 96 | + 'Ŗ' => 'R', 'ŗ' => 'r', |
|
| 97 | + 'Ř' => 'R', 'ř' => 'r', |
|
| 98 | + 'Ś' => 'S', 'ś' => 's', |
|
| 99 | + 'Ŝ' => 'S', 'ŝ' => 's', |
|
| 100 | + 'Ş' => 'S', 'ş' => 's', |
|
| 101 | 101 | 'Š' => 'S', 'š' => 's', |
| 102 | 102 | 'Ţ' => 'T', 'ţ' => 't', |
| 103 | 103 | 'Ť' => 'T', 'ť' => 't', |
@@ -197,10 +197,10 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | public function handle() |
| 199 | 199 | { |
| 200 | - Student::whereNull('gender_id')->chunkById(10, function ($students) { |
|
| 200 | + Student::whereNull('gender_id')->chunkById(10, function($students) { |
|
| 201 | 201 | $query = $students->map(fn($student) => ['id' => $student->id, 'name' => $this->remove_accents(strtok($student->firstname, " "))]); |
| 202 | 202 | |
| 203 | - $response = Http::get('https://api.genderize.io/?name[]=' . $query->pluck('name')->implode('&name[]=')); |
|
| 203 | + $response = Http::get('https://api.genderize.io/?name[]='.$query->pluck('name')->implode('&name[]=')); |
|
| 204 | 204 | foreach ($students as $student) { |
| 205 | 205 | $firstname = $query->firstWhere('id', $student->id)['name']; |
| 206 | 206 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | parent::boot(); |
| 26 | 26 | |
| 27 | - static::addGlobalScope('order', function (Builder $builder) { |
|
| 27 | + static::addGlobalScope('order', function(Builder $builder) { |
|
| 28 | 28 | $builder->orderBy('year_id')->orderBy('order')->orderBy('id'); |
| 29 | 29 | }); |
| 30 | 30 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | public function studentCount($gender = null) |
| 136 | 136 | { |
| 137 | - if (in_array($gender, [1,2])) { |
|
| 137 | + if (in_array($gender, [1, 2])) { |
|
| 138 | 138 | return DB::table('enrollments') |
| 139 | 139 | ->join('courses', 'enrollments.course_id', 'courses.id') |
| 140 | 140 | ->join('students', 'enrollments.student_id', 'students.id') |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | { |
| 202 | 202 | $period = self::where('id', '<', $this->id)->orderBy('id', 'desc')->first(); |
| 203 | 203 | |
| 204 | - if (! $period == null) { |
|
| 204 | + if (!$period == null) { |
|
| 205 | 205 | return $period; |
| 206 | 206 | } else { |
| 207 | 207 | return self::first(); |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | public function getCoursesWithPendingAttendanceAttribute() |
| 282 | 282 | { |
| 283 | 283 | // get all courses for period and preload relations |
| 284 | - $courses = $this->courses()->where(function ($query) { |
|
| 284 | + $courses = $this->courses()->where(function($query) { |
|
| 285 | 285 | $query->where('exempt_attendance', '!=', true); |
| 286 | 286 | $query->where('exempt_attendance', '!=', 1); |
| 287 | 287 | $query->orWhereNull('exempt_attendance'); |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | |
| 27 | 27 | public function studentCount($gender = null) |
| 28 | 28 | { |
| 29 | - if (in_array($gender, [1,2])) { |
|
| 29 | + if (in_array($gender, [1, 2])) { |
|
| 30 | 30 | return DB::table('enrollments') |
| 31 | 31 | ->join('courses', 'enrollments.course_id', 'courses.id') |
| 32 | 32 | ->join('periods', 'courses.period_id', 'periods.id') |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | $year_data = []; |
| 64 | 64 | $years = []; // New array |
| 65 | 65 | |
| 66 | - if (! isset($request->period)) { |
|
| 66 | + if (!isset($request->period)) { |
|
| 67 | 67 | $startperiod = Period::find(Config::where('name', 'first_external_period')->first()->value ?? Period::first()->id); |
| 68 | 68 | } else { |
| 69 | 69 | $startperiod = Period::find($request->period); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | $events = Event::with('course') |
| 26 | 26 | ->where('start', '>', Carbon::now()->subDays(30))->where('end', '<', Carbon::now()->addDays(30))->orderBy('id', 'desc') // TODO optimize this. |
| 27 | 27 | ->get() |
| 28 | - ->map(fn ($event) => [ |
|
| 28 | + ->map(fn($event) => [ |
|
| 29 | 29 | 'title' => $event->name ?? '', |
| 30 | 30 | 'resourceId' => $event->teacher_id, |
| 31 | 31 | 'start' => $event->start, |
@@ -37,14 +37,14 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | $teachers = Teacher::all()->toArray(); |
| 39 | 39 | |
| 40 | - $teachers = array_map(fn ($teacher) => [ |
|
| 40 | + $teachers = array_map(fn($teacher) => [ |
|
| 41 | 41 | 'id' => $teacher['id'], |
| 42 | 42 | 'title' => $teacher['name'] ?? '', |
| 43 | 43 | ], $teachers); |
| 44 | 44 | |
| 45 | 45 | array_push($teachers, ['id' => 'tbd', 'title' => 'Unassigned']); |
| 46 | 46 | |
| 47 | - $unassigned_events = Event::unassigned()->get()->map(fn ($event) => [ |
|
| 47 | + $unassigned_events = Event::unassigned()->get()->map(fn($event) => [ |
|
| 48 | 48 | 'title' => $event->name ?? '', |
| 49 | 49 | 'resourceId' => 'tbd', |
| 50 | 50 | 'start' => $event->start, |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | 'borderColor' => $event->color, |
| 55 | 55 | ]); |
| 56 | 56 | |
| 57 | - $leaves = Leave::orderBy('date', 'desc')->limit(10000)->get()->map(fn ($event) => [ |
|
| 57 | + $leaves = Leave::orderBy('date', 'desc')->limit(10000)->get()->map(fn($event) => [ |
|
| 58 | 58 | 'title' => $event->leaveType->name ?? 'ABS', // todo fix |
| 59 | 59 | 'resourceId' => $event['teacher_id'], |
| 60 | 60 | 'start' => $event['date'], |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | abort(403); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - $events = $teacher->events->map(fn ($event) => [ |
|
| 83 | + $events = $teacher->events->map(fn($event) => [ |
|
| 84 | 84 | 'title' => $event['name'], |
| 85 | 85 | 'start' => $event['start'], |
| 86 | 86 | 'end' => $event['end'], |
@@ -88,8 +88,8 @@ discard block |
||
| 88 | 88 | 'borderColor' => $event['color'], |
| 89 | 89 | ]); |
| 90 | 90 | |
| 91 | - $leaves = $teacher->leaves->map(fn ($event) => [ |
|
| 92 | - 'title' => $event->leaveType->name ?? 'vacances', // todo fix |
|
| 91 | + $leaves = $teacher->leaves->map(fn($event) => [ |
|
| 92 | + 'title' => $event->leaveType->name ?? 'vacances', // todo fix |
|
| 93 | 93 | 'start' => $event['date'], |
| 94 | 94 | 'allDay' => true, |
| 95 | 95 | ]); |
@@ -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', |