Passed
Push — master ( 160681...378c64 )
by Thomas
07:24
created
app/Http/Controllers/Admin/EventCrudController.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -116,13 +116,13 @@  discard block
 block discarded – undo
116 116
         ]);
117 117
 
118 118
         CRUD::addFilter(
119
-            [ // daterange filter
119
+            [// daterange filter
120 120
                 'type' => 'date_range',
121 121
                 'name' => 'from_to',
122 122
                 'label' => __('Date range'),
123 123
             ],
124 124
             false,
125
-            function ($value) { // if the filter is active, apply these constraints
125
+            function($value) { // if the filter is active, apply these constraints
126 126
                 $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR);
127 127
 
128 128
                 if ($dates->from) {
@@ -141,10 +141,10 @@  discard block
 block discarded – undo
141 141
                 'label' => __('Events with no course'),
142 142
             ],
143 143
             false,
144
-            function () { // if the filter is active, apply these constraints
144
+            function() { // if the filter is active, apply these constraints
145 145
                 $this->crud->query->where('course_id', null);
146 146
             },
147
-            function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit)
147
+            function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit)
148 148
             }
149 149
         );
150 150
 
@@ -155,22 +155,22 @@  discard block
 block discarded – undo
155 155
                 'label' => __('Events with no teacher'),
156 156
             ],
157 157
             false,
158
-            function () { // if the filter is active, apply these constraints
158
+            function() { // if the filter is active, apply these constraints
159 159
                 CRUD::addClause('unassigned');
160 160
             }
161 161
         );
162 162
 
163 163
         CRUD::addFilter(
164
-            [ // select2 filter
164
+            [// select2 filter
165 165
                 'name' => 'teacher_id',
166 166
                 'type' => 'select2',
167 167
                 'label' => __('Teacher'),
168 168
             ],
169
-            fn () => Teacher::all()->pluck('name', 'id')->toArray(),
170
-            function ($value) {
169
+            fn() => Teacher::all()->pluck('name', 'id')->toArray(),
170
+            function($value) {
171 171
                 CRUD::addClause('where', 'teacher_id', $value);
172 172
             },
173
-            function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit)
173
+            function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit)
174 174
             }
175 175
         );
176 176
     }
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/TeacherCrudController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
                 'attribute' => 'lastname',
47 47
                 'model' => User::class,
48 48
                 'orderable' => true,
49
-                'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id')
49
+                'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id')
50 50
                     ->orderBy('users.lastname', $columnDirection)->select('students.*'),
51
-                'searchLogic' => function ($query, $column, $searchTerm) {
52
-                    $query->orWhereHas('user', function ($q) use ($searchTerm) {
51
+                'searchLogic' => function($query, $column, $searchTerm) {
52
+                    $query->orWhereHas('user', function($q) use ($searchTerm) {
53 53
                         $q->where('lastname', 'like', '%'.$searchTerm.'%');
54 54
                     });
55 55
                 },
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
                 'attribute' => 'firstname',
65 65
                 'model' => User::class,
66 66
                 'orderable' => true,
67
-                'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'teachers.id')
67
+                'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'teachers.id')
68 68
                     ->orderBy('users.firstname', $columnDirection)->select('teachers.*'),
69
-                'searchLogic' => function ($query, $column, $searchTerm) {
70
-                    $query->orWhereHas('user', function ($q) use ($searchTerm) {
69
+                'searchLogic' => function($query, $column, $searchTerm) {
70
+                    $query->orWhereHas('user', function($q) use ($searchTerm) {
71 71
                         $q->where('firstname', 'like', '%'.$searchTerm.'%');
72 72
                     });
73 73
                 },
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
                 'attribute' => 'email',
82 82
                 'model' => User::class,
83 83
                 'orderable' => true,
84
-                'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'teachers.id')
84
+                'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'teachers.id')
85 85
                     ->orderBy('users.email', $columnDirection)->select('teachers.*'),
86
-                'searchLogic' => function ($query, $column, $searchTerm) {
87
-                    $query->orWhereHas('user', function ($q) use ($searchTerm) {
86
+                'searchLogic' => function($query, $column, $searchTerm) {
87
+                    $query->orWhereHas('user', function($q) use ($searchTerm) {
88 88
                         $q->where('email', 'like', '%'.$searchTerm.'%');
89 89
                     });
90 90
                 },
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
         $username_parts = array_filter(explode(' ', strtolower($fullName)));
182 182
         $username_parts = array_slice($username_parts, -2);
183 183
 
184
-        $part1 = (! empty($username_parts[0])) ? substr($username_parts[0], 0, 3) : '';
185
-        $part2 = (! empty($username_parts[1])) ? substr($username_parts[1], 0, 8) : '';
184
+        $part1 = (!empty($username_parts[0])) ? substr($username_parts[0], 0, 3) : '';
185
+        $part2 = (!empty($username_parts[1])) ? substr($username_parts[1], 0, 8) : '';
186 186
         $part3 = random_int(999, 9999);
187 187
 
188 188
         //str_shuffle to randomly shuffle all characters
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/InvoiceCrudController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
         CRUD::setModel(Invoice::class);
33 33
         CRUD::setRoute(config('backpack.base.route_prefix').'/invoice');
34 34
         CRUD::setEntityNameStrings(__('invoice'), __('invoices'));
35
-        if (! config('invoicing.price_categories_enabled')) {
35
+        if (!config('invoicing.price_categories_enabled')) {
36 36
             $this->crud->addButtonFromView('top', 'createInvoice', 'createInvoice', 'start');
37 37
         }
38 38
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
                 'label' => __('Date range'),
108 108
             ],
109 109
             false,
110
-            function ($value) { // if the filter is active, apply these constraints
110
+            function($value) { // if the filter is active, apply these constraints
111 111
                 $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR);
112 112
 
113 113
                 if ($dates->from) {
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
     {
234 234
         $invoice = Invoice::findOrFail($id)->load('payments');
235 235
 
236
-        if (! backpack_user()->can('enrollments.edit')) {
236
+        if (!backpack_user()->can('enrollments.edit')) {
237 237
             abort(403);
238 238
         }
239 239
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
             'invoice' => $invoice,
242 242
             'availablePaymentMethods' => Paymentmethod::all(),
243 243
             'editable' => true,
244
-            'enrollment' => $invoice->enrollments->first()?->product,
244
+            'enrollment' => $invoice->enrollments->first() ? ->product,
245 245
             'comments' => $invoice->comments,
246 246
             'afterSuccessUrl' => $invoice->enrollments->count() > 0 ? "/enrollment/{$invoice->enrollments->first()->product_id}/show" : '/invoice', // TODO fix this, an invoice can theoretically contain several enrollments
247 247
         ]);
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/CourseCrudController.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         CRUD::addClause('internal');
50 50
         $permissions = backpack_user()->getAllPermissions();
51 51
 
52
-        if (! $permissions->contains('name', 'courses.edit')) {
52
+        if (!$permissions->contains('name', 'courses.edit')) {
53 53
             CRUD::denyAccess(['update', 'create']);
54 54
         }
55 55
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
         CRUD::addButtonFromView('line', 'children_badge', 'children_badge', 'beginning');
61 61
 
62
-        if (! $permissions->contains('name', 'courses.delete')) {
62
+        if (!$permissions->contains('name', 'courses.delete')) {
63 63
             CRUD::denyAccess(['delete']);
64 64
         }
65 65
 
@@ -179,11 +179,11 @@  discard block
 block discarded – undo
179 179
                 'type' => 'select2',
180 180
                 'label' => __('Rhythm'),
181 181
             ],
182
-            fn () => Rhythm::all()->pluck('name', 'id')->toArray(),
183
-            function ($value) {
182
+            fn() => Rhythm::all()->pluck('name', 'id')->toArray(),
183
+            function($value) {
184 184
                 CRUD::addClause('where', 'rhythm_id', $value);
185 185
             },
186
-            function () {
186
+            function() {
187 187
                 // if the filter is NOT active (the GET parameter "checkbox" does not exit)
188 188
             }
189 189
         );
@@ -194,11 +194,11 @@  discard block
 block discarded – undo
194 194
                 'type' => 'select2',
195 195
                 'label' => __('Teacher'),
196 196
             ],
197
-            fn () => Teacher::all()->pluck('name', 'id')->toArray(),
198
-            function ($value) {
197
+            fn() => Teacher::all()->pluck('name', 'id')->toArray(),
198
+            function($value) {
199 199
                 CRUD::addClause('where', 'teacher_id', $value);
200 200
             },
201
-            function () {
201
+            function() {
202 202
                 // if the filter is NOT active (the GET parameter "checkbox" does not exit)
203 203
             }
204 204
         );
@@ -209,11 +209,11 @@  discard block
 block discarded – undo
209 209
                 'type' => 'select2',
210 210
                 'label' => __('Level'),
211 211
             ],
212
-            fn () => Level::all()->pluck('name', 'id')->toArray(),
213
-            function ($value) {
212
+            fn() => Level::all()->pluck('name', 'id')->toArray(),
213
+            function($value) {
214 214
                 CRUD::addClause('where', 'level_id', $value);
215 215
             },
216
-            function () {
216
+            function() {
217 217
                 // if the filter is NOT active (the GET parameter "checkbox" does not exit)
218 218
             }
219 219
         );
@@ -224,11 +224,11 @@  discard block
 block discarded – undo
224 224
                 'type' => 'select2',
225 225
                 'label' => __('Period'),
226 226
             ],
227
-            fn () => \App\Models\Period::all()->sortByDesc('id')->pluck('name', 'id')->toArray(),
228
-            function ($value) {
227
+            fn() => \App\Models\Period::all()->sortByDesc('id')->pluck('name', 'id')->toArray(),
228
+            function($value) {
229 229
                 CRUD::addClause('where', 'period_id', $value);
230 230
             },
231
-            function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit)
231
+            function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit)
232 232
                 $period = \App\Models\Period::get_default_period()->id;
233 233
                 CRUD::addClause('where', 'period_id', $period);
234 234
                 $this->crud->getRequest()->request->add(['period_id' => $period]); // to make the filter look active
@@ -236,13 +236,13 @@  discard block
 block discarded – undo
236 236
         );
237 237
 
238 238
         CRUD::addFilter(
239
-            [ // add a "simple" filter called Draft
239
+            [// add a "simple" filter called Draft
240 240
                 'type' => 'simple',
241 241
                 'name' => 'parent',
242 242
                 'label' => __('Hide Children Courses'),
243 243
             ],
244 244
             false,
245
-            function () {
245
+            function() {
246 246
                 CRUD::addClause('parent');
247 247
             }
248 248
         );
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
                 'label' => __('Start'),
255 255
             ],
256 256
             false,
257
-            function ($value) { // if the filter is active, apply these constraints
257
+            function($value) { // if the filter is active, apply these constraints
258 258
                 $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR);
259 259
                 $this->crud->addClause('where', 'start_date', '>=', $dates->from);
260 260
                 $this->crud->addClause('where', 'start_date', '<=', $dates->to.' 23:59:59');
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
                 'label' => __('End'),
269 269
             ],
270 270
             false,
271
-            function ($value) { // if the filter is active, apply these constraints
271
+            function($value) { // if the filter is active, apply these constraints
272 272
                 $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR);
273 273
                 $this->crud->addClause('where', 'end_date', '>=', $dates->from);
274 274
                 $this->crud->addClause('where', 'end_date', '<=', $dates->to.' 23:59:59');
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
                 'tab' => __('Course info'),
368 368
             ],
369 369
 
370
-            [   // repeatable
370
+            [// repeatable
371 371
                 'name' => 'sublevels',
372 372
                 'label' => __('Course sublevels'),
373 373
                 'type' => 'repeatable',
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
                 'default' => Period::get_enrollments_period()->end,
528 528
             ],
529 529
 
530
-            [   // repeatable
530
+            [// repeatable
531 531
                 'name' => 'times',
532 532
                 'label' => __('Course Schedule'),
533 533
                 'type' => 'repeatable',
@@ -590,14 +590,14 @@  discard block
 block discarded – undo
590 590
                 'init_rows' => 0,
591 591
             ],
592 592
 
593
-            [   // view
593
+            [// view
594 594
                 'name' => 'custom-ajax-button',
595 595
                 'type' => 'view',
596 596
                 'view' => 'courses/schedule-preset-alert',
597 597
                 'tab' => __('Schedule'),
598 598
             ],
599 599
 
600
-            [   // select_from_array
600
+            [// select_from_array
601 601
                 'name' => 'schedulepreset',
602 602
                 'label' => __('Schedule Preset'),
603 603
                 'type' => 'select_from_array',
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
         }
622 622
 
623 623
         if ($this->crud->getCurrentEntry()->children->count() > 0) {
624
-            CRUD::addField([   // view
624
+            CRUD::addField([// view
625 625
                 'name' => 'custom-ajax-button',
626 626
                 'type' => 'view',
627 627
                 'view' => 'courses/parent-course-alert',
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
         }
630 630
 
631 631
         if ($this->crud->getCurrentEntry()->parent_course_id !== null) {
632
-            CRUD::addField([   // view
632
+            CRUD::addField([// view
633 633
                 'name' => 'custom-ajax-button',
634 634
                 'type' => 'view',
635 635
                 'view' => 'courses/child-course-alert',
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/StudentCrudController.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -96,10 +96,10 @@  discard block
 block discarded – undo
96 96
                 'attribute' => 'lastname',
97 97
                 'model' => User::class,
98 98
                 'orderable' => true,
99
-                'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id')
99
+                'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id')
100 100
                     ->orderBy('users.lastname', $columnDirection)->select('students.*'),
101
-                'searchLogic' => function ($query, $column, $searchTerm) {
102
-                    $query->orWhereHas('user', function ($q) use ($searchTerm) {
101
+                'searchLogic' => function($query, $column, $searchTerm) {
102
+                    $query->orWhereHas('user', function($q) use ($searchTerm) {
103 103
                         $q->where('lastname', 'like', '%'.$searchTerm.'%');
104 104
                     });
105 105
                 },
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
                 'attribute' => 'firstname',
115 115
                 'model' => User::class,
116 116
                 'orderable' => true,
117
-                'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id')
117
+                'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id')
118 118
                     ->orderBy('users.firstname', $columnDirection)->select('students.*'),
119
-                'searchLogic' => function ($query, $column, $searchTerm) {
120
-                    $query->orWhereHas('user', function ($q) use ($searchTerm) {
119
+                'searchLogic' => function($query, $column, $searchTerm) {
120
+                    $query->orWhereHas('user', function($q) use ($searchTerm) {
121 121
                         $q->where('firstname', 'like', '%'.$searchTerm.'%');
122 122
                     });
123 123
                 },
@@ -131,10 +131,10 @@  discard block
 block discarded – undo
131 131
                 'attribute' => 'email',
132 132
                 'model' => User::class,
133 133
                 'orderable' => true,
134
-                'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id')
134
+                'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id')
135 135
                     ->orderBy('users.email', $columnDirection)->select('students.*'),
136
-                'searchLogic' => function ($query, $column, $searchTerm) {
137
-                    $query->orWhereHas('user', function ($q) use ($searchTerm) {
136
+                'searchLogic' => function($query, $column, $searchTerm) {
137
+                    $query->orWhereHas('user', function($q) use ($searchTerm) {
138 138
                         $q->where('email', 'like', '%'.$searchTerm.'%');
139 139
                     });
140 140
                 },
@@ -181,28 +181,28 @@  discard block
 block discarded – undo
181 181
         ]);
182 182
 
183 183
         CRUD::addFilter(
184
-            [ // select2 filter
184
+            [// select2 filter
185 185
                 'name' => 'enrolled',
186 186
                 'type' => 'select2',
187 187
                 'label' => __('Is Enrolled in'),
188 188
             ],
189
-            fn () => Period::all()->pluck('name', 'id')->toArray(),
190
-            function ($value) {
191
-                $this->crud->query = $this->crud->query->whereHas('enrollments', fn ($query) => $query->whereHas('course', function ($q) use ($value) {
189
+            fn() => Period::all()->pluck('name', 'id')->toArray(),
190
+            function($value) {
191
+                $this->crud->query = $this->crud->query->whereHas('enrollments', fn($query) => $query->whereHas('course', function($q) use ($value) {
192 192
                     $q->where('period_id', $value);
193 193
                 }));
194 194
             },
195
-            function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit)
195
+            function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit)
196 196
             }
197 197
         );
198 198
 
199
-        CRUD::addFilter([ // select2_multiple filter
199
+        CRUD::addFilter([// select2_multiple filter
200 200
             'name' => 'notenrolled',
201 201
             'type' => 'select2_multiple',
202 202
             'label' => __('Is Not Enrolled in'),
203
-        ], fn () => Period::all()->pluck('name', 'id')->toArray(), function ($values) {
203
+        ], fn() => Period::all()->pluck('name', 'id')->toArray(), function($values) {
204 204
             foreach (json_decode($values, null, 512, JSON_THROW_ON_ERROR) as $value) {
205
-                $this->crud->query = $this->crud->query->whereDoesntHave('enrollments', fn ($query) => $query->whereHas('course', function ($q) use ($value) {
205
+                $this->crud->query = $this->crud->query->whereDoesntHave('enrollments', fn($query) => $query->whereHas('course', function($q) use ($value) {
206 206
                     $q->where('period_id', $value);
207 207
                 }));
208 208
             }
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
                 'type' => 'select2',
215 215
                 'label' => __('New In'),
216 216
             ],
217
-            fn () => Period::all()->pluck('name', 'id')->toArray(),
218
-            function ($value) {
217
+            fn() => Period::all()->pluck('name', 'id')->toArray(),
218
+            function($value) {
219 219
                 CRUD::addClause('newInPeriod', $value);
220 220
             }
221 221
         );
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
             'name' => 'institution_id',
226 226
             'type' => 'select2',
227 227
             'label' => __('Institution'),
228
-        ], fn () => Institution::all()->pluck('name', 'id')->toArray(), function ($value) {
228
+        ], fn() => Institution::all()->pluck('name', 'id')->toArray(), function($value) {
229 229
             $this->crud->addClause('where', 'institution_id', $value);
230 230
         });
231 231
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
             'name' => 'lead_type_id',
234 234
             'type' => 'select2',
235 235
             'label' => __('Lead Status'),
236
-        ], fn () => LeadType::all()->pluck('name', 'id')->toArray(), function ($value) {
236
+        ], fn() => LeadType::all()->pluck('name', 'id')->toArray(), function($value) {
237 237
             if ($value === '4') {
238 238
                 $this->crud->query = $this->crud->query->where('lead_type_id', $value)->orWhere('lead_type_id', null);
239 239
             } else {
@@ -366,8 +366,8 @@  discard block
 block discarded – undo
366 366
         $username_parts = array_filter(explode(' ', strtolower($fullName)));
367 367
         $username_parts = array_slice($username_parts, -2);
368 368
 
369
-        $part1 = (! empty($username_parts[0])) ? substr($username_parts[0], 0, 3) : '';
370
-        $part2 = (! empty($username_parts[1])) ? substr($username_parts[1], 0, 8) : '';
369
+        $part1 = (!empty($username_parts[0])) ? substr($username_parts[0], 0, 3) : '';
370
+        $part2 = (!empty($username_parts[1])) ? substr($username_parts[1], 0, 8) : '';
371 371
         $part3 = random_int(999, 9999);
372 372
 
373 373
         //str_shuffle to randomly shuffle all characters
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
     {
456 456
         $student = Student::findOrFail($student);
457 457
 
458
-        if (! backpack_user()->isTeacher() && ! backpack_user()->can('enrollments.view')) {
458
+        if (!backpack_user()->isTeacher() && !backpack_user()->can('enrollments.view')) {
459 459
             abort(403);
460 460
         }
461 461
 
Please login to merge, or discard this patch.
app/Models/Student.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 
46 46
     public function scopeEnrolled($query)
47 47
     {
48
-        return $query->whereHas('enrollments', function ($q) {
49
-            return $q->whereHas('course', function ($q) {
48
+        return $query->whereHas('enrollments', function($q) {
49
+            return $q->whereHas('course', function($q) {
50 50
                 return $q->where('period_id', Period::get_default_period()->id);
51 51
             });
52 52
         });
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 
84 84
         return $this->hasMany(Attendance::class)
85 85
         ->where('attendance_type_id', 4) // absence
86
-        ->whereHas('event', fn ($q) => $q->whereHas('course', fn ($c) => $c->where('period_id', $period->id)));
86
+        ->whereHas('event', fn($q) => $q->whereHas('course', fn($c) => $c->where('period_id', $period->id)));
87 87
     }
88 88
 
89 89
     public function periodAttendance(Period $period = null)
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
         }
94 94
 
95 95
         return $this->hasMany(Attendance::class)
96
-        ->whereHas('event', fn ($q) => $q->whereHas('course', fn ($c) => $c->where('period_id', $period->id)));
96
+        ->whereHas('event', fn($q) => $q->whereHas('course', fn($c) => $c->where('period_id', $period->id)));
97 97
     }
98 98
 
99 99
     public function contacts()
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 
155 155
     public function getEmailAttribute(): ?string
156 156
     {
157
-        return $this?->user?->email;
157
+        return $this ? ->user ? ->email;
158 158
     }
159 159
 
160 160
     public function getNameAttribute(): string
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
     public function getIsEnrolledAttribute()
176 176
     {
177 177
         // if the student is currently enrolled
178
-        if ($this->enrollments()->whereHas('course', fn ($q) => $q->where('period_id', Period::get_default_period()->id))->count() > 0) {
178
+        if ($this->enrollments()->whereHas('course', fn($q) => $q->where('period_id', Period::get_default_period()->id))->count() > 0) {
179 179
             return 1;
180 180
         }
181 181
 
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 
275 275
     public function getImageAttribute(): ?string
276 276
     {
277
-        return $this->getMedia('profile-picture')->last()?->getUrl('thumb');
277
+        return $this->getMedia('profile-picture')->last() ? ->getUrl('thumb');
278 278
     }
279 279
 
280 280
     public function setImageAttribute($value)
Please login to merge, or discard this patch.
app/Listeners/UpdateCourseEvents.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
 
42 42
             // if there is a coursetime for today, create the event
43 43
             if ($course->times->contains('day', $courseStartDate->format('w'))) {
44
-                Event::create(['course_id' => $course->id, 'teacher_id' => $course->teacher_id, 'room_id' => $course->room_id, 'start' => $courseStartDate->setTimeFromTimeString($course->times->where('day', $courseStartDate->format('w'))->first()->start)->toDateTimeString(), 'end' => $courseStartDate->setTimeFromTimeString($course->times->where('day', $courseStartDate->format('w'))->first()->end)->toDateTimeString(), 'name' => $course->name, 'course_time_id' => $course->times->where('day', $courseStartDate->format('w'))->first()->id, 'exempt_attendance' => $course->exempt_attendance,]);
44
+                Event::create(['course_id' => $course->id, 'teacher_id' => $course->teacher_id, 'room_id' => $course->room_id, 'start' => $courseStartDate->setTimeFromTimeString($course->times->where('day', $courseStartDate->format('w'))->first()->start)->toDateTimeString(), 'end' => $courseStartDate->setTimeFromTimeString($course->times->where('day', $courseStartDate->format('w'))->first()->end)->toDateTimeString(), 'name' => $course->name, 'course_time_id' => $course->times->where('day', $courseStartDate->format('w'))->first()->id, 'exempt_attendance' => $course->exempt_attendance, ]);
45 45
             }
46 46
             $courseStartDate->addDay();
47 47
         }
Please login to merge, or discard this patch.
app/Listeners/UpdateTeacherEvents.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 
9 9
 class UpdateTeacherEvents
10 10
 {
11
-    public function handle(LeaveCreated|LeaveUpdated $event) {
11
+    public function handle(LeaveCreated | LeaveUpdated $event) {
12 12
         $teacher = $event->leave->teacher;
13 13
         foreach ($teacher->events()->whereDate('start', '>=', $event->leave->date)->whereDate('end', '<=', $event->leave->date)->get() as $event) {
14 14
             $event->teacher_id = null;
Please login to merge, or discard this patch.
app/Listeners/UpdateUsername.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 
10 10
 class UpdateUsername
11 11
 {
12
-    public function handle(TeacherUpdated|StudentUpdated|UserUpdated $event) {
12
+    public function handle(TeacherUpdated | StudentUpdated | UserUpdated $event) {
13 13
         if (User::whereUsername($event->user->email)->count() === 0) {
14 14
             $event->user->update(['username' => $event->user->email]);
15 15
         }
Please login to merge, or discard this patch.