Passed
Push — master ( dc389c...49a2c9 )
by Thomas
11:35
created
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/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/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/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/Models/Enrollment.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -56,11 +56,11 @@  discard block
 block discarded – undo
56 56
     public function scopeWithoutChildren($query)
57 57
     {
58 58
         return $query
59
-            ->where(function ($query) {
59
+            ->where(function($query) {
60 60
                 $query->whereDoesntHave('childrenEnrollments')
61 61
                 ->where('parent_id', null);
62 62
             })
63
-            ->orWhere(function ($query) {
63
+            ->orWhere(function($query) {
64 64
                 $query->where('parent_id', null);
65 65
             })
66 66
             ->get();
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
     public function scopePeriod(Builder $query, int $periodId)
84 84
     {
85
-        return $query->whereHas('course', function ($q) use ($periodId) {
85
+        return $query->whereHas('course', function($q) use ($periodId) {
86 86
             $q->where('period_id', $periodId);
87 87
         });
88 88
     }
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
         }
316 316
 
317 317
         // if enabled, retrieve the default price category for the student
318
-        if (config('invoicing.price_categories_enabled') && $this->student?->price_category) {
318
+        if (config('invoicing.price_categories_enabled') && $this->student ? ->price_category) {
319 319
             $price_category = $this->student->price_category;
320 320
 
321 321
             return $this->course->$price_category ?? 0;
@@ -340,12 +340,12 @@  discard block
 block discarded – undo
340 340
         $paidAmount = 0;
341 341
 
342 342
         foreach ($this->invoices as $invoice) {
343
-            $paidAmount += $invoice->payments?->sum('value') ?? 0;
343
+            $paidAmount += $invoice->payments ? ->sum('value') ?? 0;
344 344
         }
345 345
 
346 346
         $balance -= $paidAmount;
347 347
 
348
-        return number_format(- $balance, 2);
348
+        return number_format(-$balance, 2);
349 349
     }
350 350
 
351 351
     public function cancel()
@@ -359,11 +359,11 @@  discard block
 block discarded – undo
359 359
 
360 360
         // delete attendance records related to the enrollment
361 361
         $attendances = $this->course->attendance->where('student_id', $this->student->id);
362
-        Attendance::destroy($attendances->map(fn ($item, $key) => $item->id));
362
+        Attendance::destroy($attendances->map(fn($item, $key) => $item->id));
363 363
 
364 364
         foreach ($this->course->children as $child) {
365 365
             $attendances = $child->attendance->where('student_id', $this->student->id);
366
-            Attendance::destroy($attendances->map(fn ($item, $key) => $item->id));
366
+            Attendance::destroy($attendances->map(fn($item, $key) => $item->id));
367 367
         }
368 368
 
369 369
         $this->delete();
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
                 }
395 395
 
396 396
                 // if one book is expired
397
-                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) {
397
+                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) {
398 398
                     return 'EXP';
399 399
                 }
400 400
             }
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/EnrollmentCrudController.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
                 'attribute' => 'lastname',
119 119
                 'label' => __('Last Name'),
120 120
                 'type' => 'relationship',
121
-                'searchLogic' => function ($query, $column, $searchTerm) {
122
-                    $query->orWhereHas('student', function ($q) use ($searchTerm) {
123
-                        $q->whereHas('user', function ($q) use ($searchTerm) {
121
+                'searchLogic' => function($query, $column, $searchTerm) {
122
+                    $query->orWhereHas('student', function($q) use ($searchTerm) {
123
+                        $q->whereHas('user', function($q) use ($searchTerm) {
124 124
                             $q->where('lastname', 'like', '%'.$searchTerm.'%');
125 125
                         });
126 126
                     });
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
                 'attribute' => 'firstname',
134 134
                 'label' => __('First Name'),
135 135
                 'type' => 'relationship',
136
-                'searchLogic' => function ($query, $column, $searchTerm) {
137
-                    $query->orWhereHas('student', function ($q) use ($searchTerm) {
138
-                        $q->whereHas('user', function ($q) use ($searchTerm) {
136
+                'searchLogic' => function($query, $column, $searchTerm) {
137
+                    $query->orWhereHas('student', function($q) use ($searchTerm) {
138
+                        $q->whereHas('user', function($q) use ($searchTerm) {
139 139
                             $q->where('firstname', 'like', '%'.$searchTerm.'%');
140 140
                         });
141 141
                     });
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
                 'name' => 'status_id',
228 228
                 'type' => 'select2_multiple',
229 229
                 'label'=> __('Status'),
230
-            ], fn () => EnrollmentStatusType::all()->pluck('name', 'id')->toArray(),
231
-            function ($values) {
230
+            ], fn() => EnrollmentStatusType::all()->pluck('name', 'id')->toArray(),
231
+            function($values) {
232 232
                 // if the filter is active
233 233
                 foreach (json_decode($values, null, 512, JSON_THROW_ON_ERROR) as $value) {
234 234
                     CRUD::addClause('orWhere', 'status_id', $value);
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
                 'name' => 'period_id',
240 240
                 'type' => 'select2',
241 241
                 'label'=> __('Period'),
242
-            ], fn () => Period::all()->pluck('name', 'id')->toArray(), function ($value) {
242
+            ], fn() => Period::all()->pluck('name', 'id')->toArray(), function($value) {
243 243
                 // if the filter is active
244 244
                 CRUD::addClause('period', $value);
245 245
             });
@@ -250,12 +250,12 @@  discard block
 block discarded – undo
250 250
                     'type' => 'select2',
251 251
                     'label'=> __('Scholarship'),
252 252
                 ],
253
-                fn () => Scholarship::all()->pluck('name', 'id')->toArray(),
254
-                function ($value) { // if the filter is active
253
+                fn() => Scholarship::all()->pluck('name', 'id')->toArray(),
254
+                function($value) { // if the filter is active
255 255
                     if ($value == 'all') {
256 256
                         CRUD::addClause('whereHas', 'scholarships');
257 257
                     } else {
258
-                        CRUD::addClause('whereHas', 'scholarships', function ($q) use ($value) {
258
+                        CRUD::addClause('whereHas', 'scholarships', function($q) use ($value) {
259 259
                             $q->where('scholarships.id', $value);
260 260
                         });
261 261
                     }
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
             ->get();
276 276
 
277 277
         // get related comments
278
-        $comments = $enrollment->invoices->map(fn (Invoice $invoice) => $invoice->comments)->flatten()->concat($enrollment->comments);
278
+        $comments = $enrollment->invoices->map(fn(Invoice $invoice) => $invoice->comments)->flatten()->concat($enrollment->comments);
279 279
 
280 280
         $scholarships = Scholarship::all();
281 281
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
             'model'     => \App\Models\Course::class, // foreign key model
307 307
             'attribute' => 'name', // foreign key attribute that is shown to user
308 308
 
309
-            'options'   => (fn ($query) => $query->orderBy('level_id', 'ASC')->where('period_id', $this->crud->getCurrentEntry()->course->period_id)->get()),
309
+            'options'   => (fn($query) => $query->orderBy('level_id', 'ASC')->where('period_id', $this->crud->getCurrentEntry()->course->period_id)->get()),
310 310
         ]);
311 311
 
312 312
         CRUD::addField(array_merge([
Please login to merge, or discard this patch.
app/Models/Result.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 
24 24
         if (config('app.send_emails_for_results')) {
25 25
             // when a result is added, send a notification
26
-            static::saved(function (self $result) {
26
+            static::saved(function(self $result) {
27 27
                 Mail::to($result->enrollment->student->user->email)->locale($result->enrollment->student->user->locale)->queue(new ResultNotification($result->enrollment->course, $result->enrollment->student->user));
28 28
             });
29 29
         }
Please login to merge, or discard this patch.