Passed
Push — master ( 6bd029...1cf270 )
by Thomas
11:14 queued 01:09
created
app/Http/Controllers/CourseSkillEvaluationController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
app/Models/Event.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     /*
Please login to merge, or discard this patch.
app/Models/Course.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
      */
204 204
     public function skills()
205 205
     {
206
-        return $this->evaluationType?->skills()->orderBy('order');
206
+        return $this->evaluationType ? ->skills()->orderBy('order');
207 207
     }
208 208
 
209 209
     public function books()
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
      */
229 229
     public function getPendingAttendanceAttribute()
230 230
     {
231
-        $events = Event::where(function ($query) {
231
+        $events = Event::where(function($query) {
232 232
             $query->where('course_id', $this->id);
233 233
             $query->where('exempt_attendance', '!=', true);
234 234
             $query->where('exempt_attendance', '!=', 1);
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
             foreach ($courseTimes as $courseTime) {
362 362
                 $initial = $daysInitials[$courseTime->day];
363 363
 
364
-                if (! isset($parsedCourseTimes[$initial])) {
364
+                if (!isset($parsedCourseTimes[$initial])) {
365 365
                     $parsedCourseTimes[$initial] = [];
366 366
                 }
367 367
 
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
     public function getCourseTeacherNameAttribute()
409 409
     {
410 410
         if ($this->teacher_id) {
411
-            return $this->teacher?->name;
411
+            return $this->teacher ? ->name;
412 412
         } else {
413 413
             return '-';
414 414
         }
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 
442 442
     public function getAcceptsNewStudentsAttribute(): bool
443 443
     {
444
-        if (! $this->spots || $this->spots == 0) {
444
+        if (!$this->spots || $this->spots == 0) {
445 445
             return true;
446 446
         }
447 447
 
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 
465 465
     public function eventsWithExpectedAttendance()
466 466
     {
467
-        return $this->events()->where(function ($query) {
467
+        return $this->events()->where(function($query) {
468 468
             $query->where('exempt_attendance', '!=', true);
469 469
             $query->where('exempt_attendance', '!=', 1);
470 470
             $query->orWhereNull('exempt_attendance');
Please login to merge, or discard this patch.
app/Models/Payment.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@
 block discarded – undo
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
         };
Please login to merge, or discard this patch.
app/Models/Teacher.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -39,22 +39,22 @@  discard block
 block discarded – undo
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
 block discarded – undo
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');
Please login to merge, or discard this patch.
app/Models/Policies/StudentPolicy.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,6 +27,6 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
app/Models/Policies/CommentPolicy.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,6 +26,6 @@
 block discarded – undo
26 26
      */
27 27
     public function store_student_comment(User $user, Student $student)
28 28
     {
29
-        return ($student->enrollments()->whereHas('course', fn ($q) => $q->where('teacher_id', $user->teacher_id))->count() > 0) || $user->can('comments.edit');
29
+        return ($student->enrollments()->whereHas('course', fn($q) => $q->where('teacher_id', $user->teacher_id))->count() > 0) || $user->can('comments.edit');
30 30
     }
31 31
 }
Please login to merge, or discard this patch.
app/Models/Enrollment.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
     public function scopeWithoutChildren($query)
60 60
     {
61 61
         return $query
62
-            ->where(function ($query) {
62
+            ->where(function($query) {
63 63
                 $query->whereDoesntHave('childrenEnrollments')
64 64
                 ->where('parent_id', null);
65 65
             })
66
-            ->orWhere(function ($query) {
66
+            ->orWhere(function($query) {
67 67
                 $query->where('parent_id', null);
68 68
             })
69 69
             ->get();
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
     public function scopePeriod(Builder $query, int $periodId)
87 87
     {
88
-        return $query->whereHas('course', function ($q) use ($periodId) {
88
+        return $query->whereHas('course', function($q) use ($periodId) {
89 89
             $q->where('period_id', $periodId);
90 90
         });
91 91
     }
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
         }
319 319
 
320 320
         // if enabled, retrieve the default price category for the student
321
-        if (config('invoicing.price_categories_enabled') && $this->student?->price_category) {
321
+        if (config('invoicing.price_categories_enabled') && $this->student ? ->price_category) {
322 322
             $price_category = $this->student->price_category;
323 323
 
324 324
             return $this->course->$price_category ?? 0;
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
         $paidAmount = 0;
344 344
 
345 345
         foreach ($this->invoices as $invoice) {
346
-            $paidAmount += $invoice->payments?->sum('value') ?? 0;
346
+            $paidAmount += $invoice->payments ? ->sum('value') ?? 0;
347 347
         }
348 348
 
349 349
         $balance -= $paidAmount;
@@ -362,11 +362,11 @@  discard block
 block discarded – undo
362 362
 
363 363
         // delete attendance records related to the enrollment
364 364
         $attendances = $this->course->attendance->where('student_id', $this->student->id);
365
-        Attendance::destroy($attendances->map(fn ($item, $key) => $item->id));
365
+        Attendance::destroy($attendances->map(fn($item, $key) => $item->id));
366 366
 
367 367
         foreach ($this->course->children as $child) {
368 368
             $attendances = $child->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
 
372 372
         $this->delete();
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
                 }
398 398
 
399 399
                 // if one book is expired
400
-                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) {
400
+                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) {
401 401
                     return 'EXP';
402 402
                 }
403 403
             }
Please login to merge, or discard this patch.
app/Models/ScheduledPayment.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
     public function scopeStatus(Builder $query, $status)
31 31
     {
32
-        return match ($status) {
32
+        return match($status) {
33 33
             '2' => $query->where('status', 2)->orWhereHas('invoices'),
34 34
             '1' => $query->where('status', 1)->orWhereDoesntHave('invoices'),
35 35
             default => $query,
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
     public function getStatusTypeNameAttribute()
112 112
     {
113
-        return match ($this->computed_status) {
113
+        return match($this->computed_status) {
114 114
             2 => __('Paid'),
115 115
             1 => __('Pending'),
116 116
             default => '-',
Please login to merge, or discard this patch.