@@ -172,7 +172,7 @@ |
||
| 172 | 172 | 'price_b' => $enrollment->course->price_b, |
| 173 | 173 | 'price_c' => $enrollment->course->price_c, |
| 174 | 174 | ]), |
| 175 | - 'studentPriceCategory' => $enrollment->student?->price_category, |
|
| 175 | + 'studentPriceCategory' => $enrollment->student ? ->price_category, |
|
| 176 | 176 | ] |
| 177 | 177 | ); |
| 178 | 178 | } |
@@ -172,7 +172,7 @@ |
||
| 172 | 172 | 'price_b' => $enrollment->course->price_b, |
| 173 | 173 | 'price_c' => $enrollment->course->price_c, |
| 174 | 174 | ]), |
| 175 | - 'studentPriceCategory' => $enrollment->student?->price_category, |
|
| 175 | + 'studentPriceCategory' => $enrollment->student ? ->price_category, |
|
| 176 | 176 | ] |
| 177 | 177 | ); |
| 178 | 178 | } |
@@ -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); |