Passed
Push — master ( 99d751...45eca1 )
by Thomas
07:06
created
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/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.
app/Models/Attendance.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
         parent::boot();
22 22
 
23 23
         // when an attendance record is added, we check if this is an absence
24
-        static::saved(function (self $attendance) {
24
+        static::saved(function(self $attendance) {
25 25
             if (config('app.send_emails_for_absences') && $attendance->attendance_type_id == 4) { // todo move to configurable settings
26 26
                 // Log::info('Absence marked for student '.$attendance->student->name);
27 27
                 // will check the record again and send a notification if it hasn't changed
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
@@ -36,22 +36,22 @@  discard block
 block discarded – undo
36 36
     /** attributes */
37 37
     public function getFirstnameAttribute() : ?string
38 38
     {
39
-        return $this?->user?->firstname;
39
+        return $this ? ->user ? ->firstname;
40 40
     }
41 41
 
42 42
     public function getLastnameAttribute() : ?string
43 43
     {
44
-        return $this?->user?->lastname;
44
+        return $this ? ->user ? ->lastname;
45 45
     }
46 46
 
47 47
     public function getEmailAttribute() : ?string
48 48
     {
49
-        return $this?->user?->email;
49
+        return $this ? ->user ? ->email;
50 50
     }
51 51
 
52 52
     public function getNameAttribute() : ?string
53 53
     {
54
-        return $this?->user?->firstname.' '.$this?->user?->lastname;
54
+        return $this ? ->user ? ->firstname.' '.$this ? ->user ? ->lastname;
55 55
     }
56 56
 
57 57
     public function period_courses(Period $period)
@@ -175,14 +175,14 @@  discard block
 block discarded – undo
175 175
         $eventsWithMissingAttendance = [];
176 176
 
177 177
         $eventsWithExpectedAttendance = $this->events()
178
-        ->where(function ($query) {
178
+        ->where(function($query) {
179 179
             $query->where('exempt_attendance', '!=', true);
180 180
             $query->where('exempt_attendance', '!=', 1);
181 181
             $query->orWhereNull('exempt_attendance');
182 182
         })
183 183
         ->where('course_id', '!=', null)
184
-        ->whereHas('course', fn (Builder $query) => $query->where('period_id', $period->id)
185
-            ->where(function ($query) {
184
+        ->whereHas('course', fn(Builder $query) => $query->where('period_id', $period->id)
185
+            ->where(function($query) {
186 186
                 $query->where('exempt_attendance', '!=', true);
187 187
                 $query->where('exempt_attendance', '!=', 1);
188 188
                 $query->orWhereNull('exempt_attendance');
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->id))->count() > 0) || $user->can('comments.edit');
29
+        return ($student->enrollments()->whereHas('course', fn($q) => $q->where('teacher_id', $user->id))->count() > 0) || $user->can('comments.edit');
30 30
     }
31 31
 }
Please login to merge, or discard this patch.
app/Providers/AuthServiceProvider.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -30,69 +30,69 @@
 block discarded – undo
30 30
          * a user is allowed to edit the course grades if they are the teacher for this course,
31 31
          * or if they have explicit permission to do so
32 32
          */
33
-        Gate::define('edit-course-grades', fn ($user, $course) => $user->isTeacher() && $user->id == $course->teacher_id || $user->can('evaluation.edit'));
33
+        Gate::define('edit-course-grades', fn($user, $course) => $user->isTeacher() && $user->id == $course->teacher_id || $user->can('evaluation.edit'));
34 34
 
35 35
         /*
36 36
          * a user is allowed to view the course attendance sheet if they are the teacher for this course,
37 37
          * or if they have explicit permission to view all course attendance sheets
38 38
          */
39
-        Gate::define('view-course-attendance', fn ($user, $course) => $user->isTeacher() && $user->id == $course->teacher_id || $user->can('attendance.view'));
39
+        Gate::define('view-course-attendance', fn($user, $course) => $user->isTeacher() && $user->id == $course->teacher_id || $user->can('attendance.view'));
40 40
 
41 41
         /*
42 42
          * a user is allowed to view the event attendance sheet if they are the teacher for this event,
43 43
          * if they are the teacher for this course,
44 44
          * or if they have explicit permission to view all event attendance sheets
45 45
          */
46
-        Gate::define('view-event-attendance', fn ($user, $event) => ($event->teacher_id == $user->id) || ($event->course->teacher_id == $user->id) || $user->can('attendance.view'));
46
+        Gate::define('view-event-attendance', fn($user, $event) => ($event->teacher_id == $user->id) || ($event->course->teacher_id == $user->id) || $user->can('attendance.view'));
47 47
 
48 48
         /*
49 49
          * a user is allowed to edit an attendance sheet if they are the teacher for the event,
50 50
          * if they are the teacher for the course,
51 51
          * or if they have explicit permission to edit any attendance sheets
52 52
          */
53
-        Gate::define('edit-attendance', fn ($user, $event) => ($event->teacher_id == $user->id) || ($event->course->teacher_id == $user->id) || $user->can('attendance.edit'));
53
+        Gate::define('edit-attendance', fn($user, $event) => ($event->teacher_id == $user->id) || ($event->course->teacher_id == $user->id) || $user->can('attendance.edit'));
54 54
 
55 55
         /*
56 56
          * teachers are allowed to view their own calendar,
57 57
          * and users with explicit permission can view all calendars
58 58
          */
59
-        Gate::define('view-teacher-calendar', fn ($user, $teacher) => ($user->isTeacher() && $user->id == $teacher->id) || $user->can('calendars.view'));
59
+        Gate::define('view-teacher-calendar', fn($user, $teacher) => ($user->isTeacher() && $user->id == $teacher->id) || $user->can('calendars.view'));
60 60
 
61 61
         /*
62 62
          * teachers are allowed to view their own courses,
63 63
          * and users with explicit permission can view all courses
64 64
          */
65
-        Gate::define('view-course', fn ($user, Course $course) => ($user->isTeacher() && $user->id == $course->teacher_id) || $user->can('courses.view'));
65
+        Gate::define('view-course', fn($user, Course $course) => ($user->isTeacher() && $user->id == $course->teacher_id) || $user->can('courses.view'));
66 66
 
67 67
         /*
68 68
          * the user is allowed to view the result if they are the student,
69 69
          * if they are a teacher
70 70
          * of if they have explicit permission to view any result
71 71
          */
72
-        Gate::define('view-enrollment', fn ($user, $enrollment) => ($user->isStudent() && $user->id == $enrollment->student_id) || $user->isTeacher() || $user->can('evaluation.view'));
72
+        Gate::define('view-enrollment', fn($user, $enrollment) => ($user->isStudent() && $user->id == $enrollment->student_id) || $user->isTeacher() || $user->can('evaluation.view'));
73 73
 
74 74
         /*
75 75
          * if the user is the teacher of the course
76 76
          * of if they have explicit permission to enroll students
77 77
          */
78
-        Gate::define('enroll-in-course', fn ($user, $course) => $course->teacher_id == $user->id || $user->can('enrollments.edit'));
78
+        Gate::define('enroll-in-course', fn($user, $course) => $course->teacher_id == $user->id || $user->can('enrollments.edit'));
79 79
 
80 80
         /*
81 81
          * if the user is a teacher
82 82
          * of if they have explicit permission to enroll students
83 83
          */
84
-        Gate::define('enroll-students', fn ($user) => $user->isTeacher() || $user->can('enrollments.edit'));
84
+        Gate::define('enroll-students', fn($user) => $user->isTeacher() || $user->can('enrollments.edit'));
85 85
 
86 86
         /*
87 87
          * teachers are allowed to view their own hours,
88 88
          * and users with explicit permission can view all hours
89 89
          */
90
-        Gate::define('view-teacher-hours', fn ($user, $teacher) => ($user->isTeacher() && $user->id == $teacher->id) || $user->can('hr.view'));
90
+        Gate::define('view-teacher-hours', fn($user, $teacher) => ($user->isTeacher() && $user->id == $teacher->id) || $user->can('hr.view'));
91 91
 
92 92
         /*
93 93
          * teachers are allowed to edit results for their own students
94 94
          * as well as users with explicit permission to edit any result
95 95
          */
96
-        Gate::define('edit-result', fn ($user, $enrollment) => ($user->isTeacher() && $user->id == $enrollment->course->teacher_id) || $user->can('evaluation.edit'));
96
+        Gate::define('edit-result', fn($user, $enrollment) => ($user->isTeacher() && $user->id == $enrollment->course->teacher_id) || $user->can('evaluation.edit'));
97 97
     }
98 98
 }
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
@@ -172,7 +172,7 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
app/Http/Controllers/ScheduledPaymentController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -172,7 +172,7 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
app/Http/Controllers/TeacherCalendarController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         $events = Event::with('course')
26 26
             ->where('start', '>', Carbon::now()->subDays(30))->where('end', '<', Carbon::now()->addDays(30))->orderBy('id', 'desc') // TODO optimize this.
27 27
             ->get()
28
-            ->map(fn ($event) => [
28
+            ->map(fn($event) => [
29 29
                 'title' => $event->name ?? '',
30 30
                 'resourceId' => $event->teacher_id,
31 31
                 'start' => $event->start,
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
 
38 38
         $teachers = Teacher::all()->toArray();
39 39
 
40
-        $teachers = array_map(fn ($teacher) => [
40
+        $teachers = array_map(fn($teacher) => [
41 41
             'id' => $teacher['id'],
42 42
             'title' => $teacher['name'] ?? '',
43 43
         ], $teachers);
44 44
 
45 45
         array_push($teachers, ['id' => 'tbd', 'title' => 'Unassigned']);
46 46
 
47
-        $unassigned_events = Event::unassigned()->get()->map(fn ($event) => [
47
+        $unassigned_events = Event::unassigned()->get()->map(fn($event) => [
48 48
             'title' => $event->name ?? '',
49 49
             'resourceId' => 'tbd',
50 50
             'start' => $event->start,
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
             'borderColor' => $event->color,
55 55
         ]);
56 56
 
57
-        $leaves = Leave::orderBy('date', 'desc')->limit(10000)->get()->map(fn ($event) => [
57
+        $leaves = Leave::orderBy('date', 'desc')->limit(10000)->get()->map(fn($event) => [
58 58
             'title' => $event->leaveType->name ?? 'ABS', // todo fix
59 59
             'resourceId' => $event['teacher_id'],
60 60
             'start' => $event['date'],
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
             abort(403);
81 81
         }
82 82
 
83
-        $events = $teacher->events->map(fn ($event) => [
83
+        $events = $teacher->events->map(fn($event) => [
84 84
             'title' => $event['name'],
85 85
             'start' => $event['start'],
86 86
             'end' => $event['end'],
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
             'borderColor' => $event['color'],
89 89
         ]);
90 90
 
91
-        $leaves = $teacher->leaves->map(fn ($event) => [
92
-            'title' => $event->leaveType->name ?? 'vacances',  // todo fix
91
+        $leaves = $teacher->leaves->map(fn($event) => [
92
+            'title' => $event->leaveType->name ?? 'vacances', // todo fix
93 93
             'start' => $event['date'],
94 94
             'allDay' => true,
95 95
         ]);
Please login to merge, or discard this patch.