Passed
Push — master ( 8e761e...a643fc )
by Thomas
10:08 queued 01:09
created
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->teacher_id == $course->teacher_id || $user->can('evaluation.edit'));
33
+        Gate::define('edit-course-grades', fn($user, $course) => $user->isTeacher() && $user->teacher_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->teacher_id == $course->teacher_id || $user->can('attendance.view'));
39
+        Gate::define('view-course-attendance', fn($user, $course) => $user->isTeacher() && $user->teacher_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->teacher_id) || ($event->course->teacher_id == $user->teacher_id) || $user->can('attendance.view'));
46
+        Gate::define('view-event-attendance', fn($user, $event) => ($event->teacher_id == $user->teacher_id) || ($event->course->teacher_id == $user->teacher_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->teacher_id) || ($event->course->teacher_id == $user->teacher_id) || $user->can('attendance.edit'));
53
+        Gate::define('edit-attendance', fn($user, $event) => ($event->teacher_id == $user->teacher_id) || ($event->course->teacher_id == $user->teacher_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->teacher_id == $teacher->id) || $user->can('calendars.view'));
59
+        Gate::define('view-teacher-calendar', fn($user, $teacher) => ($user->isTeacher() && $user->teacher_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->teacher_id == $course->teacher_id) || $user->can('courses.view'));
65
+        Gate::define('view-course', fn($user, Course $course) => ($user->isTeacher() && $user->teacher_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->student_id == $enrollment->student_id) || $user->isTeacher() || $user->can('evaluation.view'));
72
+        Gate::define('view-enrollment', fn($user, $enrollment) => ($user->isStudent() && $user->student_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->teacher_id || $user->can('enrollments.edit'));
78
+        Gate::define('enroll-in-course', fn($user, $course) => $course->teacher_id == $user->teacher_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->teacher_id == $teacher->id) || $user->can('hr.view'));
90
+        Gate::define('view-teacher-hours', fn($user, $teacher) => ($user->isTeacher() && $user->teacher_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->teacher_id == $enrollment->course->teacher_id) || $user->can('evaluation.edit'));
96
+        Gate::define('edit-result', fn($user, $enrollment) => ($user->isTeacher() && $user->teacher_id == $enrollment->course->teacher_id) || $user->can('evaluation.edit'));
97 97
     }
98 98
 }
Please login to merge, or discard this patch.
app/Providers/TelescopeServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
         $this->hideSensitiveRequestDetails();
22 22
 
23
-        Telescope::filter(function (IncomingEntry $entry) {
23
+        Telescope::filter(function(IncomingEntry $entry) {
24 24
             if ($this->app->isLocal()) {
25 25
                 return true;
26 26
             }
@@ -61,6 +61,6 @@  discard block
 block discarded – undo
61 61
      */
62 62
     protected function gate()
63 63
     {
64
-        Gate::define('viewTelescope', fn ($user = null) => backpack_user() && backpack_user()->email === config('app.admin_email'));
64
+        Gate::define('viewTelescope', fn($user = null) => backpack_user() && backpack_user()->email === config('app.admin_email'));
65 65
     }
66 66
 }
Please login to merge, or discard this patch.
app/Services/ApolearnService.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
     public function updateCourse(Course $course) : void
134 134
     {
135
-        if (! $course->lms_id) {
135
+        if (!$course->lms_id) {
136 136
             $this->createCourse($course);
137 137
         }
138 138
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
             Log::info('found these teachers IDs on LMS:'.implode(', ', $teachers->pluck('id')->toArray()));
162 162
 
163 163
             // if the course has no teacher, stop
164
-            if (! $course->teacher) {
164
+            if (!$course->teacher) {
165 165
                 Log::alert('The course has no teacher on local system, removing all teachers from remote');
166 166
                 foreach ($teachers as $teacher) {
167 167
                     $this->removeTeacher($course->lms_id, $teacher['id']);
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
                     }
177 177
                 }
178 178
 
179
-                if (! $course->teacher->user->lms_id || ! $teachers->contains('id', $course->teacher->user->lms_id)) {
179
+                if (!$course->teacher->user->lms_id || !$teachers->contains('id', $course->teacher->user->lms_id)) {
180 180
                     Log::info('the course teacher has changed, need to update it');
181 181
                     $this->addTeacher($course);
182 182
                 }
@@ -186,14 +186,14 @@  discard block
 block discarded – undo
186 186
 
187 187
     public function enrollStudent(Course $course, Student $student): void
188 188
     {
189
-        if (! $course->lms_id) {
189
+        if (!$course->lms_id) {
190 190
             abort(404, 'This course is not synced with external LMS');
191 191
         }
192 192
 
193 193
         $courseId = $course->lms_id;
194 194
 
195 195
         // if the student is not synced with the LMS, create them
196
-        if (! $student->user->lms_id) {
196
+        if (!$student->user->lms_id) {
197 197
             $this->createUser($student->user);
198 198
         }
199 199
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
         // only process if the course has a teacher
217 217
         if ($course->teacher_id) {
218 218
             // if the teacher doesn't exist on LMS, create them
219
-            if (! $course->teacher->user->lms_id) {
219
+            if (!$course->teacher->user->lms_id) {
220 220
                 Log::info('creating user now');
221 221
                 $this->createUser($course->teacher->user);
222 222
             }
Please login to merge, or discard this patch.
app/Http/Controllers/RoomController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
 
25 25
         $rooms = Room::all()->toArray();
26 26
 
27
-        $rooms = array_map(fn ($room) => [
27
+        $rooms = array_map(fn($room) => [
28 28
             'id' => $room['id'],
29 29
             'title' => $room['name'],
30 30
         ], $rooms);
31 31
 
32 32
         array_push($rooms, ['id' => 'tbd', 'title' => 'Unassigned']);
33 33
 
34
-        $events = array_map(fn ($event) => [
34
+        $events = array_map(fn($event) => [
35 35
             'title' => $event['name'],
36 36
             'resourceId' => $event['room_id'],
37 37
             'start' => $event['start'],
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
         $unassigned_events = Event::where('room_id', null)->get()->toArray();
45 45
 
46
-        $unassigned_events = array_map(fn ($event) => [
46
+        $unassigned_events = array_map(fn($event) => [
47 47
             'title' => $event['name'],
48 48
             'resourceId' => 'tbd',
49 49
             'start' => $event['start'],
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     public function show(Room $room)
67 67
     {
68 68
         $events = $room->events->toArray();
69
-        $events = array_map(fn ($event) => [
69
+        $events = array_map(fn($event) => [
70 70
             'title' => $event['name'],
71 71
             'start' => $event['start'],
72 72
             'end' => $event['end'],
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
@@ -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.
app/Http/Controllers/AttendanceController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         }
113 113
 
114 114
         // get past events for the course
115
-        $events = $course->events->filter(fn ($value, $key) => Carbon::parse($value->start) < Carbon::now())->sortByDesc('start');
115
+        $events = $course->events->filter(fn($value, $key) => Carbon::parse($value->start) < Carbon::now())->sortByDesc('start');
116 116
 
117 117
         // if the course has any past events
118 118
         if (($events->count() == 0) || ($course->enrollments()->count() == 0)) {
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 
197 197
     public function toggleEventAttendanceStatus(Event $event, Request $request)
198 198
     {
199
-        if (! backpack_user()->hasPermissionTo('courses.edit')) {
199
+        if (!backpack_user()->hasPermissionTo('courses.edit')) {
200 200
             abort(403);
201 201
         }
202 202
         $event->exempt_attendance = (int) $request->status;
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 
208 208
     public function toggleCourseAttendanceStatus(Course $course, Request $request)
209 209
     {
210
-        if (! backpack_user()->hasPermissionTo('courses.edit')) {
210
+        if (!backpack_user()->hasPermissionTo('courses.edit')) {
211 211
             abort(403);
212 212
         }
213 213
         $course->exempt_attendance = (int) $request->status;
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/CommentCrudController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -85,17 +85,17 @@  discard block
 block discarded – undo
85 85
             ],
86 86
         ]);
87 87
 
88
-        CRUD::addFilter([ // simple filter
88
+        CRUD::addFilter([// simple filter
89 89
             'type' => 'simple',
90 90
             'name' => 'action',
91 91
             'label'=> 'Action',
92 92
         ],
93 93
               false,
94
-              function () { // if the filter is active
94
+              function() { // if the filter is active
95 95
                   CRUD::addClause('where', 'action', true);
96 96
               });
97 97
 
98
-        CRUD::addFilter([ // dropdown filter
98
+        CRUD::addFilter([// dropdown filter
99 99
             'name' => 'type',
100 100
             'type' => 'dropdown',
101 101
             'label'=> 'Type',
@@ -106,10 +106,10 @@  discard block
 block discarded – undo
106 106
                 Invoice::class => 'Invoice',
107 107
                 Result::class => 'Result',
108 108
 
109
-            ], function ($value) { // if the filter is active
109
+            ], function($value) { // if the filter is active
110 110
                 CRUD::addClause('where', 'commentable_type', '=', $value);
111 111
             },
112
-              function () { // if the filter is not active
112
+              function() { // if the filter is not active
113 113
                   CRUD::addClause('where', 'commentable_type', '=', Student::class);
114 114
                   $this->crud->getRequest()->request->add(['commentable_type' => Student::class]); // to make the filter look active
115 115
               });
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/InvoiceCrudController.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
         CRUD::setModel(Invoice::class);
30 30
         CRUD::setRoute(config('backpack.base.route_prefix').'/invoice');
31 31
         CRUD::setEntityNameStrings('invoice', 'invoices');
32
-        if (! config('invoicing.price_categories_enabled')) {
32
+        if (!config('invoicing.price_categories_enabled')) {
33 33
             $this->crud->addButtonFromView('top', 'createInvoice', 'createInvoice', 'start');
34 34
         }
35 35
     }
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     {
95 95
         $invoice = Invoice::findOrFail($id)->load('payments');
96 96
 
97
-        if (! backpack_user()->can('enrollments.edit')) {
97
+        if (!backpack_user()->can('enrollments.edit')) {
98 98
             abort(403);
99 99
         }
100 100
 
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/GradeTypeCrudController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
                 'type' => 'relationship',
73 73
                 'name' => 'category', // the method on your model that defines the relationship
74 74
                 'ajax' => true,
75
-                'inline_create' => [ // specify the entity in singular
75
+                'inline_create' => [// specify the entity in singular
76 76
                     'entity' => 'gradetypecategory', // the entity in singular
77 77
                     // OPTIONALS
78 78
                     'force_select' => true, // should the inline-created entry be immediately selected?
Please login to merge, or discard this patch.