@@ -30,8 +30,8 @@ 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 = random_int(999, 9999); |
| 36 | 36 | |
| 37 | 37 | $username = $part1.$part2.$part3; //str_shuffle to randomly shuffle all characters |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | { |
| 122 | 122 | |
| 123 | 123 | // if registration is closed, deny access |
| 124 | - if (! config('backpack.base.registration_open')) { |
|
| 124 | + if (!config('backpack.base.registration_open')) { |
|
| 125 | 125 | abort(403, trans('backpack::base.registration_closed')); |
| 126 | 126 | } |
| 127 | 127 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $angle = 0; |
| 72 | 72 | $width = imagesx($image); |
| 73 | 73 | $centerX = $width / 2; |
| 74 | - [$left, , $right] = imageftbbox($font_size, $angle, $font, $text); |
|
| 74 | + [$left,, $right] = imageftbbox($font_size, $angle, $font, $text); |
|
| 75 | 75 | $left_offset = ($right - $left) / 2; |
| 76 | 76 | $x = $centerX - $left_offset; |
| 77 | 77 | imagettftext($image, $font_size, $angle, $x, 450, $black, $font, $text); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $angle = 0; |
| 82 | 82 | $width = imagesx($image); |
| 83 | 83 | $centerX = $width / 2; |
| 84 | - [$left, , $right] = imageftbbox($font_size, $angle, $font, $text); |
|
| 84 | + [$left,, $right] = imageftbbox($font_size, $angle, $font, $text); |
|
| 85 | 85 | $left_offset = ($right - $left) / 2; |
| 86 | 86 | $x = $centerX - $left_offset; |
| 87 | 87 | imagettftext($image, $font_size, $angle, $x, 525, $black, $font, $text); |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $angle = 0; |
| 92 | 92 | $width = imagesx($image); |
| 93 | 93 | $centerX = $width / 2; |
| 94 | - [$left, , $right] = imageftbbox($font_size, $angle, $font, $text); |
|
| 94 | + [$left,, $right] = imageftbbox($font_size, $angle, $font, $text); |
|
| 95 | 95 | $left_offset = ($right - $left) / 2; |
| 96 | 96 | $x = $centerX - $left_offset; |
| 97 | 97 | imagettftext($image, $font_size, $angle, $x, 620, $black, $font, $text); |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $angle = 0; |
| 102 | 102 | $width = imagesx($image); |
| 103 | 103 | $centerX = $width / 2; |
| 104 | - [$left, , $right] = imageftbbox($font_size, $angle, $font, $text); |
|
| 104 | + [$left,, $right] = imageftbbox($font_size, $angle, $font, $text); |
|
| 105 | 105 | $left_offset = ($right - $left) / 2; |
| 106 | 106 | $x = $centerX - $left_offset; |
| 107 | 107 | imagettftext($image, $font_size, $angle, $x, 690, $black, $font, $text); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | $angle = 0; |
| 115 | 115 | $width = imagesx($image); |
| 116 | 116 | $centerX = $width / 2; |
| 117 | - [$left, , $right] = imageftbbox($font_size, $angle, $font, $text); |
|
| 117 | + [$left,, $right] = imageftbbox($font_size, $angle, $font, $text); |
|
| 118 | 118 | $left_offset = ($right - $left) / 2; |
| 119 | 119 | $x = $centerX - $left_offset; |
| 120 | 120 | imagettftext($image, $font_size, $angle, $x, 755, $black, $font, $text); |
@@ -71,7 +71,7 @@ |
||
| 71 | 71 | |
| 72 | 72 | // persist the products |
| 73 | 73 | foreach ($request->products as $f => $product) { |
| 74 | - $productType = match ($product['type']) { |
|
| 74 | + $productType = match($product['type']) { |
|
| 75 | 75 | 'enrollment' => Enrollment::class, |
| 76 | 76 | 'scheduledPayment' => Enrollment::class, |
| 77 | 77 | 'fee' => Fee::class, |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | public function search() |
| 40 | 40 | { |
| 41 | - return QueryBuilder::for(Course::class)->where('campus_id', 1) |
|
| 41 | + return QueryBuilder::for (Course::class)->where('campus_id', 1) |
|
| 42 | 42 | ->with('room')->withCount('events')->withCount('children')->withCount('enrollments') |
| 43 | 43 | ->allowedFilters([ |
| 44 | 44 | 'name', |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | public function redirectToUserPreferredView() |
| 54 | 54 | { |
| 55 | - return match (backpack_user()->preferred_course_view) { |
|
| 55 | + return match(backpack_user()->preferred_course_view) { |
|
| 56 | 56 | 'blocks' => redirect(route('get-courses-list')), |
| 57 | 57 | default => redirect(route('course.index')), |
| 58 | 58 | }; |
@@ -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); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | 'total_enrollment_count' => $currentPeriod->internal_enrollments_count, |
| 123 | 123 | 'resources' => $teachers, |
| 124 | 124 | 'events' => $events, |
| 125 | - 'pending_attendance' => $currentPeriod->courses_with_pending_attendance, // todo: optimize |
|
| 125 | + 'pending_attendance' => $currentPeriod->courses_with_pending_attendance, // todo: optimize |
|
| 126 | 126 | 'unassigned_events' => Event::unassigned()->count(), |
| 127 | 127 | 'pending_leads' => LeadType::find(4)->students()->count(), |
| 128 | 128 | ]); |
@@ -68,7 +68,7 @@ |
||
| 68 | 68 | |
| 69 | 69 | $course = Course::with('evaluationType')->find($enrollment->course_id); |
| 70 | 70 | |
| 71 | - $skills = $course->skills->map(function ($skill, $key) use ($student_skills) { |
|
| 71 | + $skills = $course->skills->map(function($skill, $key) use ($student_skills) { |
|
| 72 | 72 | $skill['status'] = $student_skills->where('skill_id', $skill->id)->first()->skill_scale_id ?? null; |
| 73 | 73 | |
| 74 | 74 | return $skill; |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | parent::boot(); |
| 22 | 22 | |
| 23 | 23 | // before adding an event, we check that the teacher is available |
| 24 | - static::saving(function ($event) { |
|
| 24 | + static::saving(function($event) { |
|
| 25 | 25 | $teacher = Teacher::find($event->teacher_id); |
| 26 | 26 | // if the teacher is on leave on the day of the event |
| 27 | 27 | if ($event->teacher_id !== null && $teacher) { |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | public function getColorAttribute() |
| 150 | 150 | { |
| 151 | - return $this?->course->color ?? ('#'.substr(md5($this->course_id ?? '0'), 0, 6)); |
|
| 151 | + return $this ? ->course->color ?? ('#'.substr(md5($this->course_id ?? '0'), 0, 6)); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /* |
@@ -104,7 +104,7 @@ |
||
| 104 | 104 | |
| 105 | 105 | public function getDisplayStatusAttribute() |
| 106 | 106 | { |
| 107 | - return match ($this->status) { |
|
| 107 | + return match($this->status) { |
|
| 108 | 108 | null, 1 => __('Pending'), |
| 109 | 109 | 2 => __('Paid'), |
| 110 | 110 | }; |
@@ -27,6 +27,6 @@ |
||
| 27 | 27 | { |
| 28 | 28 | // if the student is enrolled in any class by the user |
| 29 | 29 | |
| 30 | - return $student->enrollments()->whereHas('course', fn ($q) => $q->where('teacher_id', $user->id))->count() > 0; |
|
| 30 | + return $student->enrollments()->whereHas('course', fn($q) => $q->where('teacher_id', $user->id))->count() > 0; |
|
| 31 | 31 | } |
| 32 | 32 | } |