Passed
Push — master ( c6f7ff...7f26b3 )
by Thomas
07:07
created
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/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/Http/Controllers/EnrollmentController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
                         'price_b' => $enrollment->course->price_b,
184 184
                         'price_c' => $enrollment->course->price_c,
185 185
                     ]),
186
-                    'studentPriceCategory' => $enrollment->student?->price_category,
186
+                    'studentPriceCategory' => $enrollment->student ? ->price_category,
187 187
                 ]
188 188
             );
189 189
         }
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 
222 222
     public function getBalance(Request $request)
223 223
     {
224
-        if (! config('invoicing.invoices_contain_enrollments_only')) {
224
+        if (!config('invoicing.invoices_contain_enrollments_only')) {
225 225
             abort(422, 'Configuration options forbid to access this value');
226 226
         }
227 227
 
Please login to merge, or discard this patch.
app/Http/Controllers/TeacherCalendarController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         $events = Event::with('course')
26 26
             ->where('start', '>', Carbon::now()->subDays(30))->where('end', '<', Carbon::now()->addDays(30))->orderBy('id', 'desc') // TODO optimize this.
27 27
             ->get()
28
-            ->map(fn ($event) => [
28
+            ->map(fn($event) => [
29 29
                 'title' => $event->name ?? '',
30 30
                 'resourceId' => $event->teacher_id,
31 31
                 'start' => $event->start,
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
         $teachers = Teacher::all()->toArray();
39 39
 
40
-        $teachers = array_map(fn ($teacher) => [
40
+        $teachers = array_map(fn($teacher) => [
41 41
             'id' => $teacher['id'],
42 42
             'title' => $teacher['name'] ?? '',
43 43
         ], $teachers);
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         array_push($teachers, ['id' => 'tbd',
46 46
             'title' => 'Unassigned', ]);
47 47
 
48
-        $unassigned_events = Event::unassigned()->get()->map(fn ($event) => [
48
+        $unassigned_events = Event::unassigned()->get()->map(fn($event) => [
49 49
             'title' => $event->name ?? '',
50 50
             'resourceId' => 'tbd',
51 51
             'start' => $event->start,
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
             'borderColor' => $event->color,
56 56
         ]);
57 57
 
58
-        $leaves = Leave::orderBy('date', 'desc')->limit(10000)->get()->map(fn ($event) => [
58
+        $leaves = Leave::orderBy('date', 'desc')->limit(10000)->get()->map(fn($event) => [
59 59
             'title' => $event->leaveType->name ?? 'ABS',
60 60
             // todo fix
61 61
             'resourceId' => $event['teacher_id'],
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             abort(403);
83 83
         }
84 84
 
85
-        $events = $teacher->events->map(fn ($event) => [
85
+        $events = $teacher->events->map(fn($event) => [
86 86
             'title' => $event['name'],
87 87
             'start' => $event['start'],
88 88
             'end' => $event['end'],
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
             'borderColor' => $event['color'],
91 91
         ]);
92 92
 
93
-        $leaves = $teacher->leaves->map(fn ($event) => [
93
+        $leaves = $teacher->leaves->map(fn($event) => [
94 94
             'title' => $event->leaveType->name ?? 'vacances',
95 95
             // todo fix
96 96
             'start' => $event['date'],
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/ScheduledPaymentCrudController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
             'attribute' => 'lastname',
49 49
             'label' => __('Last Name'),
50 50
             'type' => 'relationship',
51
-            'searchLogic' => function ($query, $column, $searchTerm) {
52
-                $query->orWhereHas('enrollment', function ($q) use ($searchTerm) {
53
-                    $q->whereHas('user', function ($q) use ($searchTerm) {
51
+            'searchLogic' => function($query, $column, $searchTerm) {
52
+                $query->orWhereHas('enrollment', function($q) use ($searchTerm) {
53
+                    $q->whereHas('user', function($q) use ($searchTerm) {
54 54
                         $q->where('lastname', 'like', '%'.$searchTerm.'%');
55 55
                     });
56 56
                 });
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
             'attribute' => 'firstname',
64 64
             'label' => __('First Name'),
65 65
             'type' => 'relationship',
66
-            'searchLogic' => function ($query, $column, $searchTerm) {
67
-                $query->orWhereHas('enrollment', function ($q) use ($searchTerm) {
68
-                    $q->whereHas('user', function ($q) use ($searchTerm) {
66
+            'searchLogic' => function($query, $column, $searchTerm) {
67
+                $query->orWhereHas('enrollment', function($q) use ($searchTerm) {
68
+                    $q->whereHas('user', function($q) use ($searchTerm) {
69 69
                         $q->where('firstname', 'like', '%'.$searchTerm.'%');
70 70
                     });
71 71
                 });
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
             'attribute' => 'email',
79 79
             'label' => __('Email'),
80 80
             'type' => 'relationship',
81
-            'searchLogic' => function ($query, $column, $searchTerm) {
82
-                $query->orWhereHas('enrollment', function ($q) use ($searchTerm) {
83
-                    $q->whereHas('user', function ($q) use ($searchTerm) {
81
+            'searchLogic' => function($query, $column, $searchTerm) {
82
+                $query->orWhereHas('enrollment', function($q) use ($searchTerm) {
83
+                    $q->whereHas('user', function($q) use ($searchTerm) {
84 84
                         $q->where('email', 'like', '%'.$searchTerm.'%');
85 85
                     });
86 86
                 });
@@ -113,11 +113,11 @@  discard block
 block discarded – undo
113 113
                 'type' => 'select2',
114 114
                 'label' => __('Status'),
115 115
             ],
116
-            fn () => [
116
+            fn() => [
117 117
                 1 => __('Pending'),
118 118
                 2 => __('Paid'),
119 119
             ],
120
-            function ($value) {
120
+            function($value) {
121 121
                 CRUD::addClause('status', $value);
122 122
             }
123 123
         );
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/EnrollmentCrudController.php 1 patch
Spacing   +20 added lines, -20 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
                     }
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
             'model' => Course::class,
296 296
             'attribute' => 'name',
297 297
 
298
-            'options' => (fn ($query) => $query->orderBy('level_id', 'ASC')->where('period_id', $this->crud->getCurrentEntry()->course->period_id)->get()),
298
+            'options' => (fn($query) => $query->orderBy('level_id', 'ASC')->where('period_id', $this->crud->getCurrentEntry()->course->period_id)->get()),
299 299
         ]);
300 300
 
301 301
         CRUD::addField(array_merge([
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/GradeTypeCrudController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
                 'type' => 'relationship',
76 76
                 'name' => 'category',
77 77
                 'ajax' => true,
78
-                'inline_create' => [ // specify the entity in singular
78
+                'inline_create' => [// specify the entity in singular
79 79
                     'entity' => 'gradetypecategory',
80 80
                     // the entity in singular
81 81
                     // OPTIONALS
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
@@ -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
     }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
                 'label' => __('Date range'),
105 105
             ],
106 106
             false,
107
-            function ($value) { // if the filter is active, apply these constraints
107
+            function($value) { // if the filter is active, apply these constraints
108 108
                 $dates = json_decode($value, null, 512, JSON_THROW_ON_ERROR);
109 109
 
110 110
                 if ($dates->from) {
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     {
148 148
         $invoice = Invoice::findOrFail($id)->load('payments');
149 149
 
150
-        if (! backpack_user()->can('enrollments.edit')) {
150
+        if (!backpack_user()->can('enrollments.edit')) {
151 151
             abort(403);
152 152
         }
153 153
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
             'invoice' => $invoice,
156 156
             'availablePaymentMethods' => Paymentmethod::all(),
157 157
             'editable' => true,
158
-            'enrollment' => $invoice->enrollments->first()?->product,
158
+            'enrollment' => $invoice->enrollments->first() ? ->product,
159 159
             'afterSuccessUrl' => $invoice->enrollments->count() > 0 ? "/enrollment/{$invoice->enrollments->first()->product_id}/show" : '/invoice',
160 160
             // TODO fix this, an invoice can theoretically contain several enrollments
161 161
         ]);
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/PartnerCrudController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@
 block discarded – undo
104 104
             'type' => 'date',
105 105
         ]);
106 106
 
107
-        CRUD::addField([   // Checkbox
107
+        CRUD::addField([// Checkbox
108 108
             'name' => 'auto_renewal',
109 109
             'label' => __('Tacit renewal'),
110 110
             'type' => 'checkbox',
Please login to merge, or discard this patch.