Passed
Push — master ( 952446...f0a3f9 )
by Thomas
07:48 queued 11s
created
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.