Passed
Push — master ( 952446...f0a3f9 )
by Thomas
07:48 queued 11s
created
app/Providers/AuthServiceProvider.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -30,70 +30,70 @@
 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', function ($user, $enrollment) {
96
+        Gate::define('edit-result', function($user, $enrollment) {
97 97
             if ($user->can('evaluation.edit')) {
98 98
                 return true;
99 99
             }
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/EnrollmentCrudController.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -97,14 +97,14 @@  discard block
 block discarded – undo
97 97
 
98 98
         CRUD::addColumns([['name' => 'id',
99 99
             'label' => 'ID',
100
-            'wrapper' => ['element' => function ($crud, $column, $entry) {
100
+            'wrapper' => ['element' => function($crud, $column, $entry) {
101 101
                 return $entry->status_id > 2 ? 'del' : 'span';
102 102
             }], ],
103 103
 
104 104
             ['label' => __('ID number'),
105 105
                 'type' => 'text',
106 106
                 'name' => 'student.idnumber',
107
-                'wrapper' => ['element' => function ($crud, $column, $entry) {
107
+                'wrapper' => ['element' => function($crud, $column, $entry) {
108 108
                     return $entry->status_id > 2 ? 'del' : 'span';
109 109
                 }], ],
110 110
 
@@ -113,17 +113,17 @@  discard block
 block discarded – undo
113 113
                 'attribute' => 'lastname',
114 114
                 'label' => __('Last Name'),
115 115
                 'type' => 'relationship',
116
-                'wrapper' => ['element' => function ($crud, $column, $entry) {
116
+                'wrapper' => ['element' => function($crud, $column, $entry) {
117 117
                     return $entry->status_id > 2 ? 'del' : 'span';
118 118
                 }],
119 119
                 'orderable' => true,
120
-                'orderLogic' => function ($query, $column, $columnDirection) {
120
+                'orderLogic' => function($query, $column, $columnDirection) {
121 121
                     return $query->leftJoin('users', 'enrollments.student_id', '=', 'users.id')
122 122
                         ->orderBy('users.lastname', $columnDirection)->select('enrollments.*');
123 123
                 },
124
-                'searchLogic' => function ($query, $column, $searchTerm) {
125
-                    $query->orWhereHas('student', function ($q) use ($searchTerm) {
126
-                        $q->whereHas('user', function ($q) use ($searchTerm) {
124
+                'searchLogic' => function($query, $column, $searchTerm) {
125
+                    $query->orWhereHas('student', function($q) use ($searchTerm) {
126
+                        $q->whereHas('user', function($q) use ($searchTerm) {
127 127
                             $q->where('lastname', 'like', '%'.$searchTerm.'%');
128 128
                         });
129 129
                     });
@@ -135,17 +135,17 @@  discard block
 block discarded – undo
135 135
                 'attribute' => 'firstname',
136 136
                 'label' => __('First Name'),
137 137
                 'type' => 'relationship',
138
-                'wrapper' => ['element' => function ($crud, $column, $entry) {
138
+                'wrapper' => ['element' => function($crud, $column, $entry) {
139 139
                     return $entry->status_id > 2 ? 'del' : 'span';
140 140
                 }],
141
-                'searchLogic' => function ($query, $column, $searchTerm) {
142
-                    $query->orWhereHas('student', function ($q) use ($searchTerm) {
143
-                        $q->whereHas('user', function ($q) use ($searchTerm) {
141
+                'searchLogic' => function($query, $column, $searchTerm) {
142
+                    $query->orWhereHas('student', function($q) use ($searchTerm) {
143
+                        $q->whereHas('user', function($q) use ($searchTerm) {
144 144
                             $q->where('firstname', 'like', '%'.$searchTerm.'%');
145 145
                         });
146 146
                     });
147 147
                 },
148
-                'orderLogic' => function ($query, $column, $columnDirection) {
148
+                'orderLogic' => function($query, $column, $columnDirection) {
149 149
                     return $query->leftJoin('users', 'enrollments.student_id', '=', 'users.id')
150 150
                         ->orderBy('users.firstname', $columnDirection)->select('enrollments.*');
151 151
                 },
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
                     'name' => 'course.period',
170 170
                     'label' => __('Period'),
171 171
                     'attribute' => 'name',
172
-                    'orderLogic' => function ($query, $column, $columnDirection) {
172
+                    'orderLogic' => function($query, $column, $columnDirection) {
173 173
                         return $query->leftJoin('courses', 'enrollments.course_id', '=', 'courses.id')
174 174
                             ->orderBy('courses.period_id', $columnDirection)->select('enrollments.*');
175 175
                     },
@@ -184,9 +184,9 @@  discard block
 block discarded – undo
184 184
             'attribute' => 'name',
185 185
             'model' => EnrollmentStatusType::class,
186 186
             'wrapper' => ['element' => 'span',
187
-                'class' => function ($crud, $column, $entry) {
187
+                'class' => function($crud, $column, $entry) {
188 188
                     return 'badge badge-pill badge-'.$entry->enrollmentStatus->styling();
189
-                }, ], ]]);
189
+                },], ]]);
190 190
 
191 191
         if (config('invoicing.allow_scheduled_payments')) {
192 192
             CRUD::addColumn(['name' => 'scheduledPayments',
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
         if ($this->mode === 'global') {
233 233
             CRUD::addFilter(['name' => 'status_id',
234 234
                 'type' => 'select2_multiple',
235
-                'label' => __('Status'), ], fn () => EnrollmentStatusType::all()->pluck('name', 'id')->toArray(), function ($values) {
235
+                'label' => __('Status'), ], fn() => EnrollmentStatusType::all()->pluck('name', 'id')->toArray(), function($values) {
236 236
                     foreach (json_decode($values, null, 512, JSON_THROW_ON_ERROR) as $value) {
237 237
                         CRUD::addClause('orWhere', 'status_id', $value);
238 238
                     }
@@ -240,17 +240,17 @@  discard block
 block discarded – undo
240 240
 
241 241
             CRUD::addFilter(['name' => 'period_id',
242 242
                 'type' => 'select2',
243
-                'label' => __('Period'), ], fn () => Period::all()->pluck('name', 'id')->toArray(), function ($value) {
243
+                'label' => __('Period'), ], fn() => Period::all()->pluck('name', 'id')->toArray(), function($value) {
244 244
                     CRUD::addClause('period', $value);
245 245
                 });
246 246
 
247 247
             CRUD::addFilter(['name' => 'scholarship',
248 248
                 'type' => 'select2',
249
-                'label' => __('Scholarship'), ], fn () => Scholarship::all()->pluck('name', 'id')->toArray(), function ($value) {
249
+                'label' => __('Scholarship'), ], fn() => Scholarship::all()->pluck('name', 'id')->toArray(), function($value) {
250 250
                     if ($value == 'all') {
251 251
                         CRUD::addClause('whereHas', 'scholarships');
252 252
                     } else {
253
-                        CRUD::addClause('whereHas', 'scholarships', function ($q) use ($value) {
253
+                        CRUD::addClause('whereHas', 'scholarships', function($q) use ($value) {
254 254
                             $q->where('scholarships.id', $value);
255 255
                         });
256 256
                     }
@@ -271,8 +271,8 @@  discard block
 block discarded – undo
271 271
         // then load the page
272 272
         $commentsIncludingInvoices = $enrollment->comments
273 273
             ->concat($enrollment->invoices()
274
-                ->map(fn($invoice) => $invoice->comments->map(function ($comment) use ($invoice) {
275
-                    $comment->prefix = '(' . __('Invoice') . " " . ($invoice->invoice_reference ?? $invoice->id) . ")";
274
+                ->map(fn($invoice) => $invoice->comments->map(function($comment) use ($invoice) {
275
+                    $comment->prefix = '('.__('Invoice')." ".($invoice->invoice_reference ?? $invoice->id).")";
276 276
                     return $comment;
277 277
                 }))
278 278
                 ->flatten()
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
             'model' => Course::class,
305 305
             'attribute' => 'name',
306 306
 
307
-            'options' => (fn ($query) => $query->orderBy('level_id', 'ASC')->where('period_id', $this->crud->getCurrentEntry()->course->period_id)->get()),
307
+            'options' => (fn($query) => $query->orderBy('level_id', 'ASC')->where('period_id', $this->crud->getCurrentEntry()->course->period_id)->get()),
308 308
         ]);
309 309
 
310 310
         CRUD::addField(array_merge([
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
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
         $course = $event->course;
15 15
 
16 16
         // if course dates have changed, sync all events
17
-        if ($course->isDirty('start_date') || $course->isDirty('end_date') ||  $course->relationLoaded('times') && $course->times->isDirty()) {
17
+        if ($course->isDirty('start_date') || $course->isDirty('end_date') || $course->relationLoaded('times') && $course->times->isDirty()) {
18 18
             Log::info('cleaning the events after course date change');
19 19
 
20 20
             if ($course->events->count() > 0) {
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
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
92 92
                 'attribute' => 'lastname',
93 93
                 'model' => User::class,
94 94
                 'orderable' => true,
95
-                'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id')
95
+                'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id')
96 96
                     ->orderBy('users.lastname', $columnDirection)->select('students.*'),
97
-                'searchLogic' => function ($query, $column, $searchTerm) {
98
-                    $query->orWhereHas('user', function ($q) use ($searchTerm) {
97
+                'searchLogic' => function($query, $column, $searchTerm) {
98
+                    $query->orWhereHas('user', function($q) use ($searchTerm) {
99 99
                         $q->where('lastname', 'like', '%'.$searchTerm.'%');
100 100
                     });
101 101
                 },
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
                 'attribute' => 'firstname',
111 111
                 'model' => User::class,
112 112
                 'orderable' => true,
113
-                'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id')
113
+                'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id')
114 114
                     ->orderBy('users.firstname', $columnDirection)->select('students.*'),
115
-                'searchLogic' => function ($query, $column, $searchTerm) {
116
-                    $query->orWhereHas('user', function ($q) use ($searchTerm) {
115
+                'searchLogic' => function($query, $column, $searchTerm) {
116
+                    $query->orWhereHas('user', function($q) use ($searchTerm) {
117 117
                         $q->where('firstname', 'like', '%'.$searchTerm.'%');
118 118
                     });
119 119
                 },
@@ -127,10 +127,10 @@  discard block
 block discarded – undo
127 127
                 'attribute' => 'email',
128 128
                 'model' => User::class,
129 129
                 'orderable' => true,
130
-                'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id')
130
+                'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id')
131 131
                     ->orderBy('users.email', $columnDirection)->select('students.*'),
132
-                'searchLogic' => function ($query, $column, $searchTerm) {
133
-                    $query->orWhereHas('user', function ($q) use ($searchTerm) {
132
+                'searchLogic' => function($query, $column, $searchTerm) {
133
+                    $query->orWhereHas('user', function($q) use ($searchTerm) {
134 134
                         $q->where('email', 'like', '%'.$searchTerm.'%');
135 135
                     });
136 136
                 },
@@ -177,28 +177,28 @@  discard block
 block discarded – undo
177 177
         ]);
178 178
 
179 179
         CRUD::addFilter(
180
-            [ // select2 filter
180
+            [// select2 filter
181 181
                 'name' => 'enrolled',
182 182
                 'type' => 'select2',
183 183
                 'label' => __('Is Enrolled in'),
184 184
             ],
185
-            fn () => Period::all()->pluck('name', 'id')->toArray(),
186
-            function ($value) {
187
-                $this->crud->query = $this->crud->query->whereHas('enrollments', fn ($query) => $query->whereHas('course', function ($q) use ($value) {
185
+            fn() => Period::all()->pluck('name', 'id')->toArray(),
186
+            function($value) {
187
+                $this->crud->query = $this->crud->query->whereHas('enrollments', fn($query) => $query->whereHas('course', function($q) use ($value) {
188 188
                     $q->where('period_id', $value);
189 189
                 }));
190 190
             },
191
-            function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit)
191
+            function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit)
192 192
             }
193 193
         );
194 194
 
195
-        CRUD::addFilter([ // select2_multiple filter
195
+        CRUD::addFilter([// select2_multiple filter
196 196
             'name' => 'notenrolled',
197 197
             'type' => 'select2_multiple',
198 198
             'label' => __('Is Not Enrolled in'),
199
-        ], fn () => Period::all()->pluck('name', 'id')->toArray(), function ($values) {
199
+        ], fn() => Period::all()->pluck('name', 'id')->toArray(), function($values) {
200 200
             foreach (json_decode($values, null, 512, JSON_THROW_ON_ERROR) as $value) {
201
-                $this->crud->query = $this->crud->query->whereDoesntHave('enrollments', fn ($query) => $query->whereHas('course', function ($q) use ($value) {
201
+                $this->crud->query = $this->crud->query->whereDoesntHave('enrollments', fn($query) => $query->whereHas('course', function($q) use ($value) {
202 202
                     $q->where('period_id', $value);
203 203
                 }));
204 204
             }
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
                 'type' => 'select2',
211 211
                 'label' => __('New In'),
212 212
             ],
213
-            fn () => Period::all()->pluck('name', 'id')->toArray(),
214
-            function ($value) {
213
+            fn() => Period::all()->pluck('name', 'id')->toArray(),
214
+            function($value) {
215 215
                 CRUD::addClause('newInPeriod', $value);
216 216
             }
217 217
         );
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
             'name' => 'institution_id',
222 222
             'type' => 'select2',
223 223
             'label' => __('Institution'),
224
-        ], fn () => Institution::all()->pluck('name', 'id')->toArray(), function ($value) {
224
+        ], fn() => Institution::all()->pluck('name', 'id')->toArray(), function($value) {
225 225
             $this->crud->addClause('where', 'institution_id', $value);
226 226
         });
227 227
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
             'name' => 'status_type_id',
230 230
             'type' => 'select2',
231 231
             'label' => __('Lead Status'),
232
-        ], fn () => LeadType::all()->pluck('name', 'id')->toArray(), function ($value) {
232
+        ], fn() => LeadType::all()->pluck('name', 'id')->toArray(), function($value) {
233 233
             if ($value === '4') {
234 234
                 $this->crud->query = $this->crud->query->where('lead_type_id', $value)->orWhere('lead_type_id', null);
235 235
             } else {
@@ -350,8 +350,8 @@  discard block
 block discarded – undo
350 350
         $username_parts = array_filter(explode(' ', strtolower($fullName)));
351 351
         $username_parts = array_slice($username_parts, -2);
352 352
 
353
-        $part1 = (! empty($username_parts[0])) ? substr($username_parts[0], 0, 3) : '';
354
-        $part2 = (! empty($username_parts[1])) ? substr($username_parts[1], 0, 8) : '';
353
+        $part1 = (!empty($username_parts[0])) ? substr($username_parts[0], 0, 3) : '';
354
+        $part2 = (!empty($username_parts[1])) ? substr($username_parts[1], 0, 8) : '';
355 355
         $part3 = random_int(999, 9999);
356 356
 
357 357
         //str_shuffle to randomly shuffle all characters
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
     {
440 440
         $student = Student::findOrFail($student);
441 441
 
442
-        if (! backpack_user()->isTeacher() && ! backpack_user()->can('enrollments.view')) {
442
+        if (!backpack_user()->isTeacher() && !backpack_user()->can('enrollments.view')) {
443 443
             abort(403);
444 444
         }
445 445
 
Please login to merge, or discard this patch.
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.