Passed
Pull Request — master (#269)
by Thomas
06:04
created
app/Http/Controllers/Admin/StudentCrudController.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
                 'attribute' => 'lastname', // foreign key attribute that is shown to user
89 89
                 'model'     => 'App\Models\User', // foreign key model
90 90
                 'orderable' => true,
91
-                'orderLogic' => function ($query, $column, $columnDirection) {
91
+                'orderLogic' => function($query, $column, $columnDirection) {
92 92
                     return $query->leftJoin('users', 'users.id', '=', 'students.id')
93 93
                         ->orderBy('users.lastname', $columnDirection)->select('students.*');
94 94
                 },
95
-                'searchLogic' => function ($query, $column, $searchTerm) {
96
-                    $query->orWhereHas('user', function ($q) use ($searchTerm) {
95
+                'searchLogic' => function($query, $column, $searchTerm) {
96
+                    $query->orWhereHas('user', function($q) use ($searchTerm) {
97 97
                         $q->where('lastname', 'like', '%'.$searchTerm.'%');
98 98
                     });
99 99
                 },
@@ -108,12 +108,12 @@  discard block
 block discarded – undo
108 108
                 'attribute' => 'firstname', // foreign key attribute that is shown to user
109 109
                 'model'     => 'App\Models\User', // foreign key model
110 110
                 'orderable' => true,
111
-                'orderLogic' => function ($query, $column, $columnDirection) {
111
+                'orderLogic' => function($query, $column, $columnDirection) {
112 112
                     return $query->leftJoin('users', 'users.id', '=', 'students.id')
113 113
                         ->orderBy('users.firstname', $columnDirection)->select('students.*');
114 114
                 },
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,12 +127,12 @@  discard block
 block discarded – undo
127 127
                 'attribute' => 'email', // foreign key attribute that is shown to user
128 128
                 'model'     => 'App\Models\User', // foreign key model
129 129
                 'orderable' => true,
130
-                'orderLogic' => function ($query, $column, $columnDirection) {
130
+                'orderLogic' => function($query, $column, $columnDirection) {
131 131
                     return $query->leftJoin('users', 'users.id', '=', 'students.id')
132 132
                         ->orderBy('users.email', $columnDirection)->select('students.*');
133 133
                 },
134
-                'searchLogic' => function ($query, $column, $searchTerm) {
135
-                    $query->orWhereHas('user', function ($q) use ($searchTerm) {
134
+                'searchLogic' => function($query, $column, $searchTerm) {
135
+                    $query->orWhereHas('user', function($q) use ($searchTerm) {
136 136
                         $q->where('email', 'like', '%'.$searchTerm.'%');
137 137
                     });
138 138
                 },
@@ -160,32 +160,32 @@  discard block
 block discarded – undo
160 160
 
161 161
         ]);
162 162
 
163
-        CRUD::addFilter([ // select2 filter
163
+        CRUD::addFilter([// select2 filter
164 164
             'name' => 'enrolled',
165 165
             'type' => 'select2',
166 166
             'label'=> __('Is Enrolled in'),
167
-        ], function () {
167
+        ], function() {
168 168
             return Period::all()->pluck('name', 'id')->toArray();
169
-        }, function ($value) { // if the filter is active
170
-            $this->crud->query = $this->crud->query->whereHas('enrollments', function ($query) use ($value) {
171
-                return $query->whereHas('course', function ($q) use ($value) {
169
+        }, function($value) { // if the filter is active
170
+            $this->crud->query = $this->crud->query->whereHas('enrollments', function($query) use ($value) {
171
+                return $query->whereHas('course', function($q) use ($value) {
172 172
                     $q->where('period_id', $value);
173 173
                 });
174 174
             });
175 175
         },
176
-          function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit)
176
+          function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit)
177 177
           });
178 178
 
179
-        CRUD::addFilter([ // select2_multiple filter
179
+        CRUD::addFilter([// select2_multiple filter
180 180
             'name' => 'notenrolled',
181 181
             'type' => 'select2_multiple',
182 182
             'label'=> __('Is Not Enrolled in'),
183
-        ], function () { // the options that show up in the select2
183
+        ], function() { // the options that show up in the select2
184 184
             return Period::all()->pluck('name', 'id')->toArray();
185
-        }, function ($values) { // if the filter is active
185
+        }, function($values) { // if the filter is active
186 186
             foreach (json_decode($values) as $value) {
187
-                $this->crud->query = $this->crud->query->whereDoesntHave('enrollments', function ($query) use ($value) {
188
-                    return $query->whereHas('course', function ($q) use ($value) {
187
+                $this->crud->query = $this->crud->query->whereDoesntHave('enrollments', function($query) use ($value) {
188
+                    return $query->whereHas('course', function($q) use ($value) {
189 189
                         $q->where('period_id', $value);
190 190
                     });
191 191
                 });
@@ -197,9 +197,9 @@  discard block
 block discarded – undo
197 197
             'name'  => 'institution_id',
198 198
             'type'  => 'select2',
199 199
             'label' => __('Institution'),
200
-        ], function () {
200
+        ], function() {
201 201
             return Institution::all()->pluck('name', 'id')->toArray();
202
-        }, function ($value) { // if the filter is active
202
+        }, function($value) { // if the filter is active
203 203
             $this->crud->addClause('where', 'institution_id', $value);
204 204
         });
205 205
 
@@ -207,9 +207,9 @@  discard block
 block discarded – undo
207 207
             'name'  => 'status_type_id',
208 208
             'type'  => 'select2',
209 209
             'label' => __('Lead Status'),
210
-        ], function () {
210
+        ], function() {
211 211
             return LeadType::all()->pluck('name', 'id')->toArray();
212
-        }, function ($value) {
212
+        }, function($value) {
213 213
             $this->crud->addClause('computedLeadType', $value);
214 214
         });
215 215
     }
@@ -300,11 +300,11 @@  discard block
 block discarded – undo
300 300
         $username_parts = array_filter(explode(" ", strtolower($fullName)));
301 301
         $username_parts = array_slice($username_parts, -2);
302 302
 
303
-        $part1 = (!empty($username_parts[0]))?substr($username_parts[0], 0,3):"";
304
-        $part2 = (!empty($username_parts[1]))?substr($username_parts[1], 0,8):"";
303
+        $part1 = (!empty($username_parts[0])) ?substr($username_parts[0], 0, 3) : "";
304
+        $part2 = (!empty($username_parts[1])) ?substr($username_parts[1], 0, 8) : "";
305 305
         $part3 = rand(999, 9999);
306 306
 
307
-        $username = $part1. $part2. $part3; //str_shuffle to randomly shuffle all characters
307
+        $username = $part1.$part2.$part3; //str_shuffle to randomly shuffle all characters
308 308
 
309 309
         return $username;
310 310
     }
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
             $username = $request->email;
323 323
         }
324 324
         else {
325
-            $username = $this->generateUsername($request->firstname . ' ' . $request->lastname);
325
+            $username = $this->generateUsername($request->firstname.' '.$request->lastname);
326 326
         }
327 327
 
328 328
         // update the user info
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
     {
392 392
         $student = Student::findOrFail($student);
393 393
 
394
-        if (! backpack_user()->isTeacher() && ! backpack_user()->can('enrollments.view')) {
394
+        if (!backpack_user()->isTeacher() && !backpack_user()->can('enrollments.view')) {
395 395
             abort(403);
396 396
         }
397 397
 
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/ResultCrudController.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
                 'type' => 'select',
49 49
                 'name' => 'student', // the method that defines the relationship in your Model
50 50
                 'attribute' => 'name', // foreign key attribute that is shown to user
51
-                'searchLogic' => function ($query, $column, $searchTerm) {
52
-                    $query->orWhereHas('student', function ($q) use ($searchTerm) {
53
-                        $q->WhereHas('user', function ($q) use ($searchTerm) {
51
+                'searchLogic' => function($query, $column, $searchTerm) {
52
+                    $query->orWhereHas('student', function($q) use ($searchTerm) {
53
+                        $q->WhereHas('user', function($q) use ($searchTerm) {
54 54
                             $q->where('firstname', 'like', '%'.$searchTerm.'%')
55 55
                             ->orWhere('lastname', 'like', '%'.$searchTerm.'%')
56 56
                             ->orWhere('email', 'like', '%'.$searchTerm.'%')
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             'label'=> __('No Result'),
90 90
         ],
91 91
           false,
92
-          function () {
92
+          function() {
93 93
               CRUD::addClause('noResult');
94 94
           }
95 95
         );
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
             'label'=> __('Hide Parents'),
102 102
         ],
103 103
             false,
104
-            function () {
104
+            function() {
105 105
               CRUD::addClause('real');
106 106
           }
107 107
         );
@@ -110,20 +110,20 @@  discard block
 block discarded – undo
110 110
             'name' => 'period_id',
111 111
             'type' => 'select2',
112 112
             'label'=> __('Period'),
113
-        ], function () {
113
+        ], function() {
114 114
             return Period::all()->pluck('name', 'id')->toArray();
115
-        }, function ($value) { // if the filter is active
115
+        }, function($value) { // if the filter is active
116 116
             CRUD::addClause('period', $value);
117 117
         });
118 118
 
119
-        CRUD::addFilter([ // select2_multiple filter
119
+        CRUD::addFilter([// select2_multiple filter
120 120
             'name' => 'result',
121 121
             'type' => 'select2',
122 122
             'label'=> __('Result'),
123
-        ], function () { // the options that show up in the select2
123
+        ], function() { // the options that show up in the select2
124 124
             return ResultType::all()->pluck('name', 'id')->toArray();
125
-        }, function ($value) { // if the filter is active
126
-            $this->crud->query = $this->crud->query->whereHas('result', function ($query) use ($value) {
125
+        }, function($value) { // if the filter is active
126
+            $this->crud->query = $this->crud->query->whereHas('result', function($query) use ($value) {
127 127
                 $query->where('result_type_id', $value);
128 128
             });
129 129
         });
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/ExternalCourseCrudController.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -158,66 +158,66 @@  discard block
 block discarded – undo
158 158
         ]);
159 159
 
160 160
         CRUD::addFilter(
161
-            [ // select2 filter
161
+            [// select2 filter
162 162
             'name' => 'rhythm_id',
163 163
             'type' => 'select2',
164 164
             'label'=> __('Rhythm'),
165 165
         ],
166
-            function () {
166
+            function() {
167 167
             return \App\Models\Rhythm::all()->pluck('name', 'id')->toArray();
168 168
         },
169
-            function ($value) { // if the filter is active
169
+            function($value) { // if the filter is active
170 170
             CRUD::addClause('where', 'rhythm_id', $value);
171 171
         },
172
-            function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit)
172
+            function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit)
173 173
           }
174 174
         );
175 175
 
176 176
         CRUD::addFilter(
177
-            [ // select2 filter
177
+            [// select2 filter
178 178
             'name' => 'teacher_id',
179 179
             'type' => 'select2',
180 180
             'label'=> __('Teacher'),
181 181
         ],
182
-            function () {
182
+            function() {
183 183
             return \App\Models\Teacher::all()->pluck('name', 'id')->toArray();
184 184
         },
185
-            function ($value) { // if the filter is active
185
+            function($value) { // if the filter is active
186 186
             CRUD::addClause('where', 'teacher_id', $value);
187 187
         },
188
-            function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit)
188
+            function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit)
189 189
           }
190 190
         );
191 191
 
192 192
         CRUD::addFilter(
193
-            [ // select2 filter
193
+            [// select2 filter
194 194
             'name' => 'level_id',
195 195
             'type' => 'select2',
196 196
             'label'=> __('Level'),
197 197
         ],
198
-            function () {
198
+            function() {
199 199
             return \App\Models\Level::all()->pluck('name', 'id')->toArray();
200 200
         },
201
-            function ($value) { // if the filter is active
201
+            function($value) { // if the filter is active
202 202
             CRUD::addClause('where', 'level_id', $value);
203 203
         },
204
-            function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit)
204
+            function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit)
205 205
           }
206 206
         );
207 207
 
208 208
         CRUD::addFilter(
209
-            [ // select2 filter
209
+            [// select2 filter
210 210
             'name' => 'period_id',
211 211
             'type' => 'select2',
212 212
             'label'=> __('Period'),
213 213
         ],
214
-            function () {
214
+            function() {
215 215
             return Period::all()->pluck('name', 'id')->toArray();
216 216
         },
217
-            function ($value) { // if the filter is active
217
+            function($value) { // if the filter is active
218 218
             CRUD::addClause('where', 'period_id', $value);
219 219
         },
220
-            function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit)
220
+            function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit)
221 221
               $period = Period::get_default_period()->id;
222 222
               CRUD::addClause('where', 'period_id', $period);
223 223
               $this->crud->getRequest()->request->add(['period_id' => $period]); // to make the filter look active
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
                 'tab' => __('Course info'),
364 364
             ],
365 365
 
366
-            [   // repeatable
366
+            [// repeatable
367 367
                 'name'  => 'times',
368 368
                 'label' => __('Course Schedule'),
369 369
                 'type'  => 'repeatable',
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
                 'tab' => __('Schedule'),
403 403
             ],
404 404
 
405
-            [   // view
405
+            [// view
406 406
                 'name' => 'custom-ajax-button',
407 407
                 'type' => 'view',
408 408
                 'view' => 'courses/schedule-preset-alert',
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
                 'tab' => __('Course info'),
557 557
             ],
558 558
 
559
-            [   // repeatable
559
+            [// repeatable
560 560
                 'name'  => 'times',
561 561
                 'label' => __('Course Schedule'),
562 562
                 'type'  => 'repeatable',
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/PaymentCrudController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     public function setup()
36 36
     {
37 37
         CRUD::setModel(\App\Models\Payment::class);
38
-        CRUD::setRoute(config('backpack.base.route_prefix') . '/payment');
38
+        CRUD::setRoute(config('backpack.base.route_prefix').'/payment');
39 39
         CRUD::setEntityNameStrings('payment', 'payments');
40 40
 
41 41
         $this->crud->enableExportButtons();
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
             'label' => __('Due Date'),
55 55
         ],
56 56
             false,
57
-            function ($value) { // if the filter is active, apply these constraints
57
+            function($value) { // if the filter is active, apply these constraints
58 58
                 $this->crud->addClause('where', 'date', '>=', Carbon::parse($value)->firstOfMonth());
59 59
                 $this->crud->addClause('where', 'date', '<=', Carbon::parse($value)->lastOfMonth());
60 60
             });
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
     {
96 96
         $payment = Payment::findOrFail($id);
97 97
 
98
-        if (! backpack_user()->can('enrollments.edit')) {
98
+        if (!backpack_user()->can('enrollments.edit')) {
99 99
             abort(403);
100 100
         }
101 101
 
102
-        if (! $payment->invoice)
102
+        if (!$payment->invoice)
103 103
         {
104 104
             abort(404, 'No enrollment found for this payment');
105 105
         }
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', // the method on your model that defines the relationship
77 77
                 'ajax' => true,
78
-                'inline_create' => [ // specify the entity in singular
78
+                'inline_create' => [// specify the entity in singular
79 79
                     'entity' => 'gradetypecategory', // the entity in singular
80 80
                     // OPTIONALS
81 81
                     'force_select' => true, // should the inline-created entry be immediately selected?
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/SchedulePresetCrudController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
     public function setup()
28 28
     {
29 29
         CRUD::setModel(\App\Models\SchedulePreset::class);
30
-        CRUD::setRoute(config('backpack.base.route_prefix') . '/schedulepreset');
30
+        CRUD::setRoute(config('backpack.base.route_prefix').'/schedulepreset');
31 31
         CRUD::setEntityNameStrings('Schedule Preset', 'Schedule Presets');
32 32
     }
33 33
 
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/ProfessionCrudController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
     public function setup()
27 27
     {
28 28
         CRUD::setModel(\App\Models\Profession::class);
29
-        CRUD::setRoute(config('backpack.base.route_prefix') . '/profession');
29
+        CRUD::setRoute(config('backpack.base.route_prefix').'/profession');
30 30
         CRUD::setEntityNameStrings('profession', 'professions');
31 31
     }
32 32
 
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/CommentCrudController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -86,17 +86,17 @@  discard block
 block discarded – undo
86 86
             ],
87 87
         ]);
88 88
 
89
-        CRUD::addFilter([ // simple filter
89
+        CRUD::addFilter([// simple filter
90 90
             'type' => 'simple',
91 91
             'name' => 'action',
92 92
             'label'=> 'Action',
93 93
         ],
94 94
               false,
95
-              function () { // if the filter is active
95
+              function() { // if the filter is active
96 96
                   CRUD::addClause('where', 'action', true);
97 97
               });
98 98
 
99
-        CRUD::addFilter([ // dropdown filter
99
+        CRUD::addFilter([// dropdown filter
100 100
             'name' => 'type',
101 101
             'type' => 'dropdown',
102 102
             'label'=> 'Type',
@@ -107,10 +107,10 @@  discard block
 block discarded – undo
107 107
             Invoice::class => 'Invoice',
108 108
             Result::class => 'Result',
109 109
 
110
-        ], function ($value) { // if the filter is active
110
+        ], function($value) { // if the filter is active
111 111
             CRUD::addClause('where', 'commentable_type', '=', $value);
112 112
         },
113
-              function () { // if the filter is not active
113
+              function() { // if the filter is not active
114 114
                   CRUD::addClause('where', 'commentable_type', '=', Student::class);
115 115
                   $this->crud->getRequest()->request->add(['commentable_type' => Student::class]); // to make the filter look active
116 116
               });
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/UserCrudController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
                 'label' => trans('backpack::permissionmanager.email'),
48 48
                 'type'  => 'email',
49 49
             ],
50
-            [ // n-n relationship (with pivot table)
50
+            [// n-n relationship (with pivot table)
51 51
                 'label'     => trans('backpack::permissionmanager.roles'), // Table column heading
52 52
                 'type'      => 'select_multiple',
53 53
                 'name'      => 'roles', // the method that defines the relationship in your Model
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
                 'label' => trans('backpack::permissionmanager.role'),
67 67
             ],
68 68
             config('permission.models.role')::all()->pluck(['name', 'id'])->toArray(),
69
-            function ($value) {
69
+            function($value) {
70 70
                 // if the filter is active
71
-                $this->crud->addClause('whereHas', 'roles', function ($query) use ($value) {
71
+                $this->crud->addClause('whereHas', 'roles', function($query) use ($value) {
72 72
                     $query->where('role_id', '=', $value);
73 73
                 });
74 74
             }
@@ -119,12 +119,12 @@  discard block
 block discarded – undo
119 119
     protected function addFields()
120 120
     {
121 121
         $this->crud->addFields([
122
-            [  // Select2
122
+            [// Select2
123 123
                 'label' => trans('firstname'),
124 124
                 'type' => 'text',
125 125
                 'name' => 'firstname',
126 126
             ],
127
-            [  // Select2
127
+            [// Select2
128 128
                 'label' => trans('lastname'),
129 129
                 'type' => 'text',
130 130
                 'name' => 'lastname',
Please login to merge, or discard this patch.