Passed
Push — master ( 74870e...73ff1c )
by Thomas
08:20
created
app/Http/Controllers/Admin/EventCrudController.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -119,15 +119,15 @@  discard block
 block discarded – undo
119 119
             ],
120 120
             false,
121 121
             function ($value) { // if the filter is active, apply these constraints
122
-              $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR);
123
-
124
-              if ($dates->from) {
125
-                  CRUD::addClause('where', 'start', '>=', $dates->from);
126
-              }
127
-              if ($dates->to) {
128
-                  CRUD::addClause('where', 'start', '<=', $dates->to.' 23:59:59');
129
-              }
130
-          }
122
+                $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR);
123
+
124
+                if ($dates->from) {
125
+                    CRUD::addClause('where', 'start', '>=', $dates->from);
126
+                }
127
+                if ($dates->to) {
128
+                    CRUD::addClause('where', 'start', '<=', $dates->to.' 23:59:59');
129
+                }
130
+            }
131 131
         );
132 132
 
133 133
         CRUD::addFilter(
@@ -138,10 +138,10 @@  discard block
 block discarded – undo
138 138
             ],
139 139
             false,
140 140
             function ($value) { // if the filter is active, apply these constraints
141
-              $this->crud->query->where('course_id', null);
142
-          },
141
+                $this->crud->query->where('course_id', null);
142
+            },
143 143
             function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit)
144
-          }
144
+            }
145 145
         );
146 146
 
147 147
         CRUD::addFilter(
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
             ],
153 153
             false,
154 154
             function ($value) { // if the filter is active, apply these constraints
155
-              CRUD::addClause('unassigned');
156
-          }
155
+                CRUD::addClause('unassigned');
156
+            }
157 157
         );
158 158
 
159 159
         CRUD::addFilter(
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
             CRUD::addClause('where', 'teacher_id', $value);
168 168
         },
169 169
             function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit)
170
-          }
170
+            }
171 171
         );
172 172
     }
173 173
 
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -112,13 +112,13 @@  discard block
 block discarded – undo
112 112
         ]);
113 113
 
114 114
         CRUD::addFilter(
115
-            [ // daterange filter
115
+            [// daterange filter
116 116
                 'type' => 'date_range',
117 117
                 'name' => 'from_to',
118 118
                 'label'=> __('Date range'),
119 119
             ],
120 120
             false,
121
-            function ($value) { // if the filter is active, apply these constraints
121
+            function($value) { // if the filter is active, apply these constraints
122 122
               $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR);
123 123
 
124 124
               if ($dates->from) {
@@ -137,10 +137,10 @@  discard block
 block discarded – undo
137 137
                 'label'=> __('Events with no course'),
138 138
             ],
139 139
             false,
140
-            function ($value) { // if the filter is active, apply these constraints
140
+            function($value) { // if the filter is active, apply these constraints
141 141
               $this->crud->query->where('course_id', null);
142 142
           },
143
-            function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit)
143
+            function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit)
144 144
           }
145 145
         );
146 146
 
@@ -151,22 +151,22 @@  discard block
 block discarded – undo
151 151
                 'label'=> __('Events with no teacher'),
152 152
             ],
153 153
             false,
154
-            function ($value) { // if the filter is active, apply these constraints
154
+            function($value) { // if the filter is active, apply these constraints
155 155
               CRUD::addClause('unassigned');
156 156
           }
157 157
         );
158 158
 
159 159
         CRUD::addFilter(
160
-            [ // select2 filter
160
+            [// select2 filter
161 161
                 'name' => 'teacher_id',
162 162
                 'type' => 'select2',
163 163
                 'label'=> __('Teacher'),
164 164
             ],
165
-            fn () => Teacher::all()->pluck('name', 'id')->toArray(),
166
-            function ($value) { // if the filter is active
165
+            fn() => Teacher::all()->pluck('name', 'id')->toArray(),
166
+            function($value) { // if the filter is active
167 167
             CRUD::addClause('where', 'teacher_id', $value);
168 168
         },
169
-            function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit)
169
+            function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit)
170 170
           }
171 171
         );
172 172
     }
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/ResultCrudController.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
                             $q->where('firstname', 'like', '%'.$searchTerm.'%')
59 59
                             ->orWhere('lastname', 'like', '%'.$searchTerm.'%')
60 60
                             ->orWhere('email', 'like', '%'.$searchTerm.'%')
61
-                          ->orWhere('idnumber', 'like', '%'.$searchTerm.'%');
61
+                            ->orWhere('idnumber', 'like', '%'.$searchTerm.'%');
62 62
                         });
63 63
                     });
64 64
                 },
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
             ],
96 96
             false,
97 97
             function () {
98
-              CRUD::addClause('noResult');
99
-          }
98
+                CRUD::addClause('noResult');
99
+            }
100 100
         );
101 101
 
102 102
         CRUD::addFilter(
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
                 'type' => 'select',
53 53
                 'name' => 'student',
54 54
                 'attribute' => 'name',
55
-                'searchLogic' => function ($query, $column, $searchTerm) {
56
-                    $query->orWhereHas('student', function ($q) use ($searchTerm) {
57
-                        $q->WhereHas('user', function ($q) use ($searchTerm) {
55
+                'searchLogic' => function($query, $column, $searchTerm) {
56
+                    $query->orWhereHas('student', function($q) use ($searchTerm) {
57
+                        $q->WhereHas('user', function($q) use ($searchTerm) {
58 58
                             $q->where('firstname', 'like', '%'.$searchTerm.'%')
59 59
                             ->orWhere('lastname', 'like', '%'.$searchTerm.'%')
60 60
                             ->orWhere('email', 'like', '%'.$searchTerm.'%')
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
                 'label'=> __('No Result'),
95 95
             ],
96 96
             false,
97
-            function () {
97
+            function() {
98 98
               CRUD::addClause('noResult');
99 99
           }
100 100
         );
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
                 'label'=> __('Hide Parents'),
107 107
             ],
108 108
             false,
109
-            function () {
109
+            function() {
110 110
                 CRUD::addClause('real');
111 111
             }
112 112
         );
@@ -115,16 +115,16 @@  discard block
 block discarded – undo
115 115
             'name' => 'period_id',
116 116
             'type' => 'select2',
117 117
             'label'=> __('Period'),
118
-        ], fn () => Period::all()->pluck('name', 'id')->toArray(), function ($value) { // if the filter is active
118
+        ], fn() => Period::all()->pluck('name', 'id')->toArray(), function($value) { // if the filter is active
119 119
             CRUD::addClause('period', $value);
120 120
         });
121 121
 
122
-        CRUD::addFilter([ // select2_multiple filter
122
+        CRUD::addFilter([// select2_multiple filter
123 123
             'name' => 'result',
124 124
             'type' => 'select2',
125 125
             'label'=> __('Result'),
126
-        ], fn () => ResultType::all()->pluck('name', 'id')->toArray(), function ($value) { // if the filter is active
127
-            $this->crud->query = $this->crud->query->whereHas('result', function ($query) use ($value) {
126
+        ], fn() => ResultType::all()->pluck('name', 'id')->toArray(), function($value) { // if the filter is active
127
+            $this->crud->query = $this->crud->query->whereHas('result', function($query) use ($value) {
128 128
                 $query->where('result_type_id', $value);
129 129
             });
130 130
         });
Please login to merge, or discard this patch.
app/Http/Controllers/ReportController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
         $year_data = [];
64 64
         $years = []; // New array
65 65
 
66
-        if (! isset($request->period)) {
66
+        if (!isset($request->period)) {
67 67
             $startperiod = Period::find(Config::where('name', 'first_external_period')->first()->value ?? Period::first()->id);
68 68
         } else {
69 69
             $startperiod = Period::find($request->period);
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
             ->where('id', '>=', $startperiod->id)
204 204
             ->get()
205 205
             ->groupBy('year_id')
206
-            ->map(function ($yearData) {
206
+            ->map(function($yearData) {
207 207
                 $yearPeriods = [];
208 208
 
209 209
                 foreach ($yearData as $period) {
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 
308 308
     private function getStartperiod(Request $request)
309 309
     {
310
-        if (! isset($request->period)) {
310
+        if (!isset($request->period)) {
311 311
             $startperiod = Period::find(Config::where('name', 'first_period')->first()->value);
312 312
         } else {
313 313
             $startperiod = Period::find($request->period);
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/EnrollmentCrudController.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
                 'name' => 'id',
93 93
                 'label' => 'ID',
94 94
                 'wrapper' => [
95
-                    'element' => function ($crud, $column, $entry) {
95
+                    'element' => function($crud, $column, $entry) {
96 96
                         return $entry->status_id > 2 ? 'del' : 'span';
97 97
                     },
98 98
                 ],
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
                 'type' => 'text',
104 104
                 'name' => 'student.idnumber',
105 105
                 'wrapper' => [
106
-                    'element' => function ($crud, $column, $entry) {
106
+                    'element' => function($crud, $column, $entry) {
107 107
                         return $entry->status_id > 2 ? 'del' : 'span';
108 108
                     },
109 109
                 ],
@@ -116,13 +116,13 @@  discard block
 block discarded – undo
116 116
                 'label' => __('Last Name'),
117 117
                 'type' => 'relationship',
118 118
                 'wrapper' => [
119
-                    'element' => function ($crud, $column, $entry) {
119
+                    'element' => function($crud, $column, $entry) {
120 120
                         return $entry->status_id > 2 ? 'del' : 'span';
121 121
                     },
122 122
                 ],
123
-                'searchLogic' => function ($query, $column, $searchTerm) {
124
-                    $query->orWhereHas('student', function ($q) use ($searchTerm) {
125
-                        $q->whereHas('user', function ($q) use ($searchTerm) {
123
+                'searchLogic' => function($query, $column, $searchTerm) {
124
+                    $query->orWhereHas('student', function($q) use ($searchTerm) {
125
+                        $q->whereHas('user', function($q) use ($searchTerm) {
126 126
                             $q->where('lastname', 'like', '%'.$searchTerm.'%');
127 127
                         });
128 128
                     });
@@ -136,13 +136,13 @@  discard block
 block discarded – undo
136 136
                 'label' => __('First Name'),
137 137
                 'type' => 'relationship',
138 138
                 'wrapper' => [
139
-                    'element' => function ($crud, $column, $entry) {
139
+                    'element' => function($crud, $column, $entry) {
140 140
                         return $entry->status_id > 2 ? 'del' : 'span';
141 141
                     },
142 142
                 ],
143
-                'searchLogic' => function ($query, $column, $searchTerm) {
144
-                    $query->orWhereHas('student', function ($q) use ($searchTerm) {
145
-                        $q->whereHas('user', function ($q) use ($searchTerm) {
143
+                'searchLogic' => function($query, $column, $searchTerm) {
144
+                    $query->orWhereHas('student', function($q) use ($searchTerm) {
145
+                        $q->whereHas('user', function($q) use ($searchTerm) {
146 146
                             $q->where('firstname', 'like', '%'.$searchTerm.'%');
147 147
                         });
148 148
                     });
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                 'model' => EnrollmentStatusType::class,
189 189
                 'wrapper' => [
190 190
                     'element' => 'span',
191
-                    'class' => function ($crud, $column, $entry) {
191
+                    'class' => function($crud, $column, $entry) {
192 192
                         return 'badge badge-pill badge-'.$entry->enrollmentStatus->styling();
193 193
                     },
194 194
                 ],
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
                     'type' => 'select2_multiple',
237 237
                     'label'=> __('Status'),
238 238
                 ],
239
-                fn () => EnrollmentStatusType::all()->pluck('name', 'id')->toArray(),
240
-                function ($values) {
239
+                fn() => EnrollmentStatusType::all()->pluck('name', 'id')->toArray(),
240
+                function($values) {
241 241
                 foreach (json_decode($values, null, 512, JSON_THROW_ON_ERROR) as $value) {
242 242
                     CRUD::addClause('orWhere', 'status_id', $value);
243 243
                 }
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
                 'name' => 'period_id',
249 249
                 'type' => 'select2',
250 250
                 'label'=> __('Period'),
251
-            ], fn () => Period::all()->pluck('name', 'id')->toArray(), function ($value) {
251
+            ], fn() => Period::all()->pluck('name', 'id')->toArray(), function($value) {
252 252
                 CRUD::addClause('period', $value);
253 253
             });
254 254
 
@@ -258,12 +258,12 @@  discard block
 block discarded – undo
258 258
                     'type' => 'select2',
259 259
                     'label'=> __('Scholarship'),
260 260
                 ],
261
-                fn () => Scholarship::all()->pluck('name', 'id')->toArray(),
262
-                function ($value) { // if the filter is active
261
+                fn() => Scholarship::all()->pluck('name', 'id')->toArray(),
262
+                function($value) { // if the filter is active
263 263
                     if ($value == 'all') {
264 264
                         CRUD::addClause('whereHas', 'scholarships');
265 265
                     } else {
266
-                        CRUD::addClause('whereHas', 'scholarships', function ($q) use ($value) {
266
+                        CRUD::addClause('whereHas', 'scholarships', function($q) use ($value) {
267 267
                             $q->where('scholarships.id', $value);
268 268
                         });
269 269
                     }
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
             'model'     => \App\Models\Course::class,
304 304
             'attribute' => 'name',
305 305
 
306
-            'options'   => (fn ($query) => $query->orderBy('level_id', 'ASC')->where('period_id', $this->crud->getCurrentEntry()->course->period_id)->get()),
306
+            'options'   => (fn($query) => $query->orderBy('level_id', 'ASC')->where('period_id', $this->crud->getCurrentEntry()->course->period_id)->get()),
307 307
         ]);
308 308
 
309 309
         CRUD::addField(array_merge([
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
     }
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     {
115 115
         $invoice = Invoice::findOrFail($id)->load('payments');
116 116
 
117
-        if (! backpack_user()->can('enrollments.edit')) {
117
+        if (!backpack_user()->can('enrollments.edit')) {
118 118
             abort(403);
119 119
         }
120 120
 
Please login to merge, or discard this patch.
app/Http/Controllers/InvoiceController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
 
72 72
         // persist the products
73 73
         foreach ($request->products as $f => $product) {
74
-            $productType = match ($product['type']) {
74
+            $productType = match($product['type']) {
75 75
                 'enrollment' => Enrollment::class,
76 76
                 'scheduledPayment' => ScheduledPayment::class,
77 77
                 'fee' => Fee::class,
Please login to merge, or discard this patch.
app/Models/Enrollment.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
     public function scopeWithoutChildren($query)
61 61
     {
62 62
         return $query
63
-            ->where(function ($query) {
63
+            ->where(function($query) {
64 64
                 $query->whereDoesntHave('childrenEnrollments')
65 65
                 ->where('parent_id', null);
66 66
             })
67
-            ->orWhere(function ($query) {
67
+            ->orWhere(function($query) {
68 68
                 $query->where('parent_id', null);
69 69
             })
70 70
             ->get();
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
     public function scopePeriod(Builder $query, int $periodId)
88 88
     {
89
-        return $query->whereHas('course', function ($q) use ($periodId) {
89
+        return $query->whereHas('course', function($q) use ($periodId) {
90 90
             $q->where('period_id', $periodId);
91 91
         });
92 92
     }
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
     // also includes invoices for this enrollment's scheduled payments.
181 181
     public function relatedInvoices()
182 182
     {
183
-        $scheduledPaymentsInvoices = $this->scheduledPayments->map(fn (ScheduledPayment $scheduledPayment) => $scheduledPayment->invoices());
183
+        $scheduledPaymentsInvoices = $this->scheduledPayments->map(fn(ScheduledPayment $scheduledPayment) => $scheduledPayment->invoices());
184 184
 
185 185
         return $this->invoices()->concat($scheduledPaymentsInvoices)->flatten(1);
186 186
     }
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
         }
333 333
 
334 334
         // if enabled, retrieve the default price category for the student
335
-        if (config('invoicing.price_categories_enabled') && $this->student?->price_category) {
335
+        if (config('invoicing.price_categories_enabled') && $this->student ? ->price_category) {
336 336
             $price_category = $this->student->price_category;
337 337
 
338 338
             return $this->course->$price_category ?? 0;
@@ -362,11 +362,11 @@  discard block
 block discarded – undo
362 362
 
363 363
         // delete attendance records related to the enrollment
364 364
         $attendances = $this->course->attendance->where('student_id', $this->student->id);
365
-        Attendance::destroy($attendances->map(fn ($item, $key) => $item->id));
365
+        Attendance::destroy($attendances->map(fn($item, $key) => $item->id));
366 366
 
367 367
         foreach ($this->course->children as $child) {
368 368
             $attendances = $child->attendance->where('student_id', $this->student->id);
369
-            Attendance::destroy($attendances->map(fn ($item, $key) => $item->id));
369
+            Attendance::destroy($attendances->map(fn($item, $key) => $item->id));
370 370
         }
371 371
 
372 372
         $this->delete();
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
                 }
398 398
 
399 399
                 // if one book is expired
400
-                if ($this->student && $this->student->books->where('id', $book->id)->filter(fn ($book) => $book->pivot->expiry_date == null || $book->pivot->expiry_date > Carbon::now())->count() == 0) {
400
+                if ($this->student && $this->student->books->where('id', $book->id)->filter(fn($book) => $book->pivot->expiry_date == null || $book->pivot->expiry_date > Carbon::now())->count() == 0) {
401 401
                     return 'EXP';
402 402
                 }
403 403
             }
Please login to merge, or discard this patch.
app/Models/ScheduledPayment.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
     public function scopeStatus(Builder $query, $status)
29 29
     {
30
-        return match ($status) {
30
+        return match($status) {
31 31
             '2' => $query->where('status', 2),
32 32
             '1' => $query->where('status', 1),
33 33
             default => $query,
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
     public function getStatusTypeNameAttribute()
121 121
     {
122
-        return match ($this->status) {
122
+        return match($this->status) {
123 123
             2 => __('Paid'),
124 124
             1 => __('Pending'),
125 125
             default => '-',
Please login to merge, or discard this patch.
app/Console/Commands/compare_invoice_pricesCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
         foreach (Invoice::all() as $invoice) {
19 19
             if ($invoice->total_price !== $invoice->totalPrice()) {
20 20
                 $anomalies++;
21
-                echo "\ninvoice ".$invoice->id. ' should be ' . $invoice->total_price . ' vs ' . $invoice->totalPrice() .' real ';
21
+                echo "\ninvoice ".$invoice->id.' should be '.$invoice->total_price.' vs '.$invoice->totalPrice().' real ';
22 22
             }
23 23
         }
24 24
         echo "\n".$anomalies.' anomalies detected';
Please login to merge, or discard this patch.