Completed
Pull Request — master (#3175)
by jxlwqq
02:22
created
src/Grid/Tools/ColumnSelector.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
         $this->setupScript($show, $columns);
40 40
 
41
-        $lists = $columns->map(function ($val, $key) use ($show) {
41
+        $lists = $columns->map(function($val, $key) use ($show) {
42 42
             if (empty($show)) {
43 43
                 $checked = 'checked';
44 44
             } else {
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      */
74 74
     protected function getGridColumns()
75 75
     {
76
-        return $this->grid->columns()->map(function (Grid\Column $column) {
76
+        return $this->grid->columns()->map(function(Grid\Column $column) {
77 77
             $name = $column->getName();
78 78
 
79 79
             if (in_array($name, ['__row_selector__', '__actions__'])) {
Please login to merge, or discard this patch.
src/Controllers/PermissionController.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
         $grid->slug(trans('admin.slug'));
91 91
         $grid->name(trans('admin.name'));
92 92
 
93
-        $grid->http_path(trans('admin.route'))->display(function ($path) {
94
-            return collect(explode("\n", $path))->map(function ($path) {
93
+        $grid->http_path(trans('admin.route'))->display(function($path) {
94
+            return collect(explode("\n", $path))->map(function($path) {
95 95
                 $method = $this->http_method ?: ['ANY'];
96 96
 
97 97
                 if (Str::contains($path, ':')) {
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
                     $method = explode(',', $method);
100 100
                 }
101 101
 
102
-                $method = collect($method)->map(function ($name) {
102
+                $method = collect($method)->map(function($name) {
103 103
                     return strtoupper($name);
104
-                })->map(function ($name) {
104
+                })->map(function($name) {
105 105
                     return "<span class='label label-primary'>{$name}</span>";
106 106
                 })->implode('&nbsp;');
107 107
 
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
         $grid->created_at(trans('admin.created_at'));
117 117
         $grid->updated_at(trans('admin.updated_at'));
118 118
 
119
-        $grid->tools(function (Grid\Tools $tools) {
120
-            $tools->batch(function (Grid\Tools\BatchActions $actions) {
119
+        $grid->tools(function(Grid\Tools $tools) {
120
+            $tools->batch(function(Grid\Tools\BatchActions $actions) {
121 121
                 $actions->disableDelete();
122 122
             });
123 123
         });
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
         $show->slug(trans('admin.slug'));
143 143
         $show->name(trans('admin.name'));
144 144
 
145
-        $show->http_path(trans('admin.route'))->as(function ($path) {
146
-            return collect(explode("\r\n", $path))->map(function ($path) {
145
+        $show->http_path(trans('admin.route'))->as(function($path) {
146
+            return collect(explode("\r\n", $path))->map(function($path) {
147 147
                 $method = $this->http_method ?: ['ANY'];
148 148
 
149 149
                 if (Str::contains($path, ':')) {
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
                     $method = explode(',', $method);
152 152
                 }
153 153
 
154
-                $method = collect($method)->map(function ($name) {
154
+                $method = collect($method)->map(function($name) {
155 155
                     return strtoupper($name);
156
-                })->map(function ($name) {
156
+                })->map(function($name) {
157 157
                     return "<span class='label label-primary'>{$name}</span>";
158 158
                 })->implode('&nbsp;');
159 159
 
Please login to merge, or discard this patch.
src/Grid.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 
372 372
         array_push($visible, '__row_selector__', '__actions__');
373 373
 
374
-        return $this->columns->filter(function (Column $column) use ($visible) {
374
+        return $this->columns->filter(function(Column $column) use ($visible) {
375 375
             return in_array($column->getName(), $visible);
376 376
         });
377 377
     }
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 
392 392
         array_push($visible, '__row_selector__', '__actions__');
393 393
 
394
-        return collect($this->columnNames)->filter(function ($column) use ($visible) {
394
+        return collect($this->columnNames)->filter(function($column) use ($visible) {
395 395
             return in_array($column, $visible);
396 396
         });
397 397
     }
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
         $column = new Column($column, $label);
410 410
         $column->setGrid($this);
411 411
 
412
-        return tap($column, function ($value) {
412
+        return tap($column, function($value) {
413 413
             $this->columns->push($value);
414 414
         });
415 415
     }
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
         $column = new Column($column, $label);
428 428
         $column->setGrid($this);
429 429
 
430
-        return tap($column, function ($value) {
430
+        return tap($column, function($value) {
431 431
             $this->columns->prepend($value);
432 432
         });
433 433
     }
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 
585 585
         Column::setOriginalGridModels($collection);
586 586
 
587
-        $this->columns->map(function (Column $column) use (&$data) {
587
+        $this->columns->map(function(Column $column) use (&$data) {
588 588
             $data = $column->fill($data);
589 589
 
590 590
             $this->columnNames[] = $column->getName();
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
      */
689 689
     protected function buildRows(array $data)
690 690
     {
691
-        $this->rows = collect($data)->map(function ($model, $number) {
691
+        $this->rows = collect($data)->map(function($model, $number) {
692 692
             return new Row($number, $model);
693 693
         });
694 694
 
Please login to merge, or discard this patch.
src/Show/Field.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
      */
180 180
     public function using(array $values, $default = null)
181 181
     {
182
-        return $this->as(function ($value) use ($values, $default) {
182
+        return $this->as(function($value) use ($values, $default) {
183 183
             if (is_null($value)) {
184 184
                 return $default;
185 185
             }
@@ -199,8 +199,8 @@  discard block
 block discarded – undo
199 199
      */
200 200
     public function image($server = '', $width = 200, $height = 200)
201 201
     {
202
-        return $this->unescape()->as(function ($images) use ($server, $width, $height) {
203
-            return collect($images)->map(function ($path) use ($server, $width, $height) {
202
+        return $this->unescape()->as(function($images) use ($server, $width, $height) {
203
+            return collect($images)->map(function($path) use ($server, $width, $height) {
204 204
                 if (empty($path)) {
205 205
                     return '';
206 206
                 }
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
     {
237 237
         $field = $this;
238 238
 
239
-        return $this->unescape()->as(function ($path) use ($server, $download, $field) {
239
+        return $this->unescape()->as(function($path) use ($server, $download, $field) {
240 240
             $name = basename($path);
241 241
 
242 242
             $field->wrapped = false;
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
      */
289 289
     public function link($href = '', $target = '_blank')
290 290
     {
291
-        return $this->unescape()->as(function ($link) use ($href, $target) {
291
+        return $this->unescape()->as(function($link) use ($href, $target) {
292 292
             $href = $href ?: $link;
293 293
 
294 294
             return "<a href='$href' target='{$target}'>{$link}</a>";
@@ -304,12 +304,12 @@  discard block
 block discarded – undo
304 304
      */
305 305
     public function label($style = 'success')
306 306
     {
307
-        return $this->unescape()->as(function ($value) use ($style) {
307
+        return $this->unescape()->as(function($value) use ($style) {
308 308
             if ($value instanceof Arrayable) {
309 309
                 $value = $value->toArray();
310 310
             }
311 311
 
312
-            return collect((array) $value)->map(function ($name) use ($style) {
312
+            return collect((array) $value)->map(function($name) use ($style) {
313 313
                 return "<span class='label label-{$style}'>$name</span>";
314 314
             })->implode('&nbsp;');
315 315
         });
@@ -324,12 +324,12 @@  discard block
 block discarded – undo
324 324
      */
325 325
     public function badge($style = 'blue')
326 326
     {
327
-        return $this->unescape()->as(function ($value) use ($style) {
327
+        return $this->unescape()->as(function($value) use ($style) {
328 328
             if ($value instanceof Arrayable) {
329 329
                 $value = $value->toArray();
330 330
             }
331 331
 
332
-            return collect((array) $value)->map(function ($name) use ($style) {
332
+            return collect((array) $value)->map(function($name) use ($style) {
333 333
                 return "<span class='badge bg-{$style}'>$name</span>";
334 334
             })->implode('&nbsp;');
335 335
         });
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
     {
345 345
         $field = $this;
346 346
 
347
-        return $this->unescape()->as(function ($value) use ($field) {
347
+        return $this->unescape()->as(function($value) use ($field) {
348 348
             $content = json_decode($value, true);
349 349
 
350 350
             if (json_last_error() == 0) {
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
     public function render()
481 481
     {
482 482
         if ($this->showAs->isNotEmpty()) {
483
-            $this->showAs->each(function ($callable) {
483
+            $this->showAs->each(function($callable) {
484 484
                 $this->value = $callable->call(
485 485
                     $this->parent->getModel(),
486 486
                     $this->value
Please login to merge, or discard this patch.
src/Grid/Tools.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      */
86 86
     public function disableFilterButton(bool $disable = true)
87 87
     {
88
-        $this->tools = $this->tools->map(function ($tool) use ($disable) {
88
+        $this->tools = $this->tools->map(function($tool) use ($disable) {
89 89
             if ($tool instanceof FilterButton) {
90 90
                 return $tool->disable($disable);
91 91
             }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      */
102 102
     public function disableRefreshButton(bool $disable = true)
103 103
     {
104
-        $this->tools = $this->tools->map(function (AbstractTool $tool) use ($disable) {
104
+        $this->tools = $this->tools->map(function(AbstractTool $tool) use ($disable) {
105 105
             if ($tool instanceof RefreshButton) {
106 106
                 return $tool->disable($disable);
107 107
             }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      */
118 118
     public function disableBatchActions(bool $disable = true)
119 119
     {
120
-        $this->tools = $this->tools->map(function ($tool) use ($disable) {
120
+        $this->tools = $this->tools->map(function($tool) use ($disable) {
121 121
             if ($tool instanceof BatchActions) {
122 122
                 return $tool->disable($disable);
123 123
             }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
      */
132 132
     public function batch(\Closure $closure)
133 133
     {
134
-        call_user_func($closure, $this->tools->first(function ($tool) {
134
+        call_user_func($closure, $this->tools->first(function($tool) {
135 135
             return $tool instanceof BatchActions;
136 136
         }));
137 137
     }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
      */
144 144
     public function render()
145 145
     {
146
-        return $this->tools->map(function ($tool) {
146
+        return $this->tools->map(function($tool) {
147 147
             if ($tool instanceof AbstractTool) {
148 148
                 if (!$tool->allowed()) {
149 149
                     return '';
Please login to merge, or discard this patch.
src/Middleware/Permission.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
             return $next($request);
34 34
         }
35 35
 
36
-        if (!Admin::user()->allPermissions()->first(function ($permission) use ($request) {
36
+        if (!Admin::user()->allPermissions()->first(function($permission) use ($request) {
37 37
             return $permission->shouldPassThrough($request);
38 38
         })) {
39 39
             Checker::error();
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      */
53 53
     public function checkRoutePermission(Request $request)
54 54
     {
55
-        if (!$middleware = collect($request->route()->middleware())->first(function ($middleware) {
55
+        if (!$middleware = collect($request->route()->middleware())->first(function($middleware) {
56 56
             return Str::startsWith($middleware, $this->middlewarePrefix);
57 57
         })) {
58 58
             return false;
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
         return collect($excepts)
89 89
             ->map('admin_base_path')
90
-            ->contains(function ($except) use ($request) {
90
+            ->contains(function($except) use ($request) {
91 91
                 if ($except !== '/') {
92 92
                     $except = trim($except, '/');
93 93
                 }
Please login to merge, or discard this patch.
src/Middleware/Authenticate.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
 
44 44
         return collect($excepts)
45 45
             ->map('admin_base_path')
46
-            ->contains(function ($except) use ($request) {
46
+            ->contains(function($except) use ($request) {
47 47
                 if ($except !== '/') {
48 48
                     $except = trim($except, '/');
49 49
                 }
Please login to merge, or discard this patch.
src/Form/NestedForm.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -209,7 +209,7 @@
 block discarded – undo
209 209
             $values = $this->original[$key];
210 210
         }
211 211
 
212
-        $this->fields->each(function (Field $field) use ($values) {
212
+        $this->fields->each(function(Field $field) use ($values) {
213 213
             $field->setOriginal($values);
214 214
         });
215 215
     }
Please login to merge, or discard this patch.