Passed
Push — master ( 6bd029...1cf270 )
by Thomas
11:14 queued 01:09
created
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.
app/Models/Student.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 
47 47
     public function scopeEnrolled($query)
48 48
     {
49
-        return $query->whereHas('enrollments', function ($q) {
50
-            return $q->whereHas('course', function ($q) {
49
+        return $query->whereHas('enrollments', function($q) {
50
+            return $q->whereHas('course', function($q) {
51 51
                 return $q->where('period_id', Period::get_default_period()->id);
52 52
             });
53 53
         });
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 
56 56
     public function scopeComputedLeadType($query, $leadTypeId)
57 57
     {
58
-        return match ($leadTypeId) {
59
-            1 => $query->whereHas('enrollments', fn ($query) => $query->whereHas('course', function ($q) {
58
+        return match($leadTypeId) {
59
+            1 => $query->whereHas('enrollments', fn($query) => $query->whereHas('course', function($q) {
60 60
                 $q->where('period_id', Period::get_default_period()->id);
61 61
             })),
62 62
 
@@ -64,15 +64,15 @@  discard block
 block discarded – undo
64 64
 
65 65
             4 => $query
66 66
                 ->where('lead_type_id', $leadTypeId)
67
-                ->orWhere(function ($query) {
67
+                ->orWhere(function($query) {
68 68
                     $query
69 69
                         ->whereNull('lead_type_id')
70
-                        ->whereHas('enrollments', fn ($query) => $query
71
-                            ->whereHas('course', function ($q) {
70
+                        ->whereHas('enrollments', fn($query) => $query
71
+                            ->whereHas('course', function($q) {
72 72
                                 $q->where('period_id', '!=', Period::get_default_period()->id);
73 73
                             }))
74
-                        ->whereDoesntHave('enrollments', fn ($query) => $query
75
-                            ->whereHas('course', function ($q) {
74
+                        ->whereDoesntHave('enrollments', fn($query) => $query
75
+                            ->whereHas('course', function($q) {
76 76
                                 $q->where('period_id', Period::get_default_period()->id);
77 77
                             }));
78 78
                 }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
         return $this->hasMany(Attendance::class)
115 115
         ->where('attendance_type_id', 4) // absence
116
-        ->whereHas('event', fn ($q) => $q->whereHas('course', fn ($c) => $c->where('period_id', $period->id)));
116
+        ->whereHas('event', fn($q) => $q->whereHas('course', fn($c) => $c->where('period_id', $period->id)));
117 117
     }
118 118
 
119 119
     public function periodAttendance(Period $period = null)
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         }
124 124
 
125 125
         return $this->hasMany(Attendance::class)
126
-        ->whereHas('event', fn ($q) => $q->whereHas('course', fn ($c) => $c->where('period_id', $period->id)));
126
+        ->whereHas('event', fn($q) => $q->whereHas('course', fn($c) => $c->where('period_id', $period->id)));
127 127
     }
128 128
 
129 129
     public function contacts()
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 
202 202
     public function getEmailAttribute(): ?string
203 203
     {
204
-        return $this?->user?->email;
204
+        return $this ? ->user ? ->email;
205 205
     }
206 206
 
207 207
     public function getNameAttribute(): string
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
     public function getIsEnrolledAttribute()
235 235
     {
236 236
         // if the student is currently enrolled
237
-        if ($this->enrollments()->whereHas('course', fn ($q) => $q->where('period_id', Period::get_default_period()->id))->count() > 0) {
237
+        if ($this->enrollments()->whereHas('course', fn($q) => $q->where('period_id', Period::get_default_period()->id))->count() > 0) {
238 238
             return 1;
239 239
         }
240 240
     }
Please login to merge, or discard this patch.
app/Models/Partner.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
     public function getFormattedStartDateAttribute()
26 26
     {
27
-        if (! $this->started_on) {
27
+        if (!$this->started_on) {
28 28
             return '-';
29 29
         }
30 30
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
     public function getFormattedEndDateAttribute()
35 35
     {
36
-        if (! $this->expired_on) {
36
+        if (!$this->expired_on) {
37 37
             return '-';
38 38
         }
39 39
 
Please login to merge, or discard this patch.
app/Events/LeadStatusUpdatedEvent.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 
21 21
     public $lastname;
22 22
 
23
-    public function __construct(Student|Contact $user, public $listId)
23
+    public function __construct(Student | Contact $user, public $listId)
24 24
     {
25 25
         $this->email = $user->email;
26 26
         $this->name = $user->firstname;
Please login to merge, or discard this patch.
app/Console/Commands/migrateGrades.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
             }
59 59
 
60 60
             // if no match has been found
61
-            if (! $matchFound) {
61
+            if (!$matchFound) {
62 62
                 echo 'no match; creating new eval type';
63 63
                 $evalType = EvaluationType::create(['name' => 'cours '.$entry->course_id]);
64 64
                 $evalType->gradeTypes()->sync($courseGradeTypes);
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
             }
86 86
 
87 87
             // if no match has been found
88
-            if (! $matchFound) {
88
+            if (!$matchFound) {
89 89
                 $levelName = isset($course->level) ? $course->level->name : $course->id;
90 90
                 $evalType = EvaluationType::create(['name' => 'Niveau '.$levelName]);
91 91
                 $evalType->skills()->sync($courseSkills);
Please login to merge, or discard this patch.
app/Http/Controllers/EnrollmentController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@
 block discarded – undo
92 92
                         'priceB' => $enrollment->course->price_b,
93 93
                         'priceC' => $enrollment->course->price_c,
94 94
                     ]),
95
-                    'studentPriceCategory' => $enrollment->student?->price_category,
95
+                    'studentPriceCategory' => $enrollment->student ? ->price_category,
96 96
                 ]
97 97
             );
98 98
         }
Please login to merge, or discard this patch.