Completed
Pull Request — master (#3979)
by
unknown
07:34
created
src/Controllers/HandleController.php 1 patch
Unused Use Statements   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -2,15 +2,15 @@
 block discarded – undo
2 2
 
3 3
 namespace Encore\Admin\Controllers;
4 4
 
5
-use Encore\Admin\Actions\Action;
6
-use Encore\Admin\Actions\GridAction;
7
-use Encore\Admin\Actions\Response;
8
-use Encore\Admin\Actions\RowAction;
9
-use Encore\Admin\Widgets\Form;
10
-use Exception;
11
-use Illuminate\Database\Eloquent\Model;
12
-use Illuminate\Http\Request;
13
-use Illuminate\Routing\Controller;
5
+use Encore\Admin\Actions\Action;
6
+use Encore\Admin\Actions\GridAction;
7
+use Encore\Admin\Actions\Response;
8
+use Encore\Admin\Actions\RowAction;
9
+use Encore\Admin\Widgets\Form;
10
+use Exception;
11
+use Illuminate\Database\Eloquent\Model;
12
+use Illuminate\Http\Request;
13
+use Illuminate\Routing\Controller;
14 14
 use Illuminate\Support\Collection;
15 15
 
16 16
 class HandleController extends Controller
Please login to merge, or discard this patch.
src/Controllers/LogController.php 2 patches
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@
 block discarded – undo
2 2
 
3 3
 namespace Encore\Admin\Controllers;
4 4
 
5
-use Encore\Admin\Auth\Database\OperationLog;
6
-use Encore\Admin\Grid;
5
+use Encore\Admin\Auth\Database\OperationLog;
6
+use Encore\Admin\Grid;
7 7
 use Illuminate\Support\Arr;
8 8
 
9 9
 class LogController extends AdminController
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,14 +27,14 @@  discard block
 block discarded – undo
27 27
 
28 28
         $grid->column('id', 'ID')->sortable();
29 29
         $grid->column('user.name', 'User');
30
-        $grid->column('method')->display(function ($method) {
30
+        $grid->column('method')->display(function($method) {
31 31
             $color = Arr::get(OperationLog::$methodColors, $method, 'grey');
32 32
 
33 33
             return "<span class=\"badge bg-$color\">$method</span>";
34 34
         });
35 35
         $grid->column('path')->label('info');
36 36
         $grid->column('ip')->label('primary');
37
-        $grid->column('input')->display(function ($input) {
37
+        $grid->column('input')->display(function($input) {
38 38
             $input = json_decode($input, true);
39 39
             $input = Arr::except($input, ['_pjax', '_token', '_method', '_previous_']);
40 40
             if (empty($input)) {
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
 
47 47
         $grid->column('created_at', trans('admin.created_at'));
48 48
 
49
-        $grid->actions(function (Grid\Displayers\Actions $actions) {
49
+        $grid->actions(function(Grid\Displayers\Actions $actions) {
50 50
             $actions->disableEdit();
51 51
             $actions->disableView();
52 52
         });
53 53
 
54 54
         $grid->disableCreateButton();
55 55
 
56
-        $grid->filter(function (Grid\Filter $filter) {
56
+        $grid->filter(function(Grid\Filter $filter) {
57 57
             $userModel = config('admin.database.users_model');
58 58
 
59 59
             $filter->equal('user_id', 'User')->select($userModel::all()->pluck('name', 'id'));
Please login to merge, or discard this patch.
src/Controllers/MenuController.php 2 patches
Unused Use Statements   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -2,12 +2,12 @@
 block discarded – undo
2 2
 
3 3
 namespace Encore\Admin\Controllers;
4 4
 
5
-use Encore\Admin\Form;
6
-use Encore\Admin\Layout\Column;
7
-use Encore\Admin\Layout\Content;
8
-use Encore\Admin\Layout\Row;
9
-use Encore\Admin\Tree;
10
-use Encore\Admin\Widgets\Box;
5
+use Encore\Admin\Form;
6
+use Encore\Admin\Layout\Column;
7
+use Encore\Admin\Layout\Content;
8
+use Encore\Admin\Layout\Row;
9
+use Encore\Admin\Tree;
10
+use Encore\Admin\Widgets\Box;
11 11
 use Illuminate\Routing\Controller;
12 12
 
13 13
 class MenuController extends Controller
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
         return $content
27 27
             ->title(trans('admin.menu'))
28 28
             ->description(trans('admin.list'))
29
-            ->row(function (Row $row) {
29
+            ->row(function(Row $row) {
30 30
                 $row->column(6, $this->treeView()->render());
31 31
 
32
-                $row->column(6, function (Column $column) {
32
+                $row->column(6, function(Column $column) {
33 33
                     $form = new \Encore\Admin\Widgets\Form();
34 34
                     $form->action(admin_url('auth/menu'));
35 35
 
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
     {
72 72
         $menuModel = config('admin.database.menu_model');
73 73
 
74
-        return $menuModel::tree(function (Tree $tree) {
74
+        return $menuModel::tree(function(Tree $tree) {
75 75
             $tree->disableCreate();
76 76
 
77
-            $tree->branch(function ($branch) {
77
+            $tree->branch(function($branch) {
78 78
                 $payload = "<i class='fa {$branch['icon']}'></i>&nbsp;<strong>{$branch['title']}</strong>";
79 79
 
80 80
                 if (!isset($branch['children'])) {
Please login to merge, or discard this patch.
src/Controllers/PermissionController.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@
 block discarded – undo
143 143
     /**
144 144
      * Get options of HTTP methods select field.
145 145
      *
146
-     * @return array
146
+     * @return callable
147 147
      */
148 148
     protected function getHttpMethodsOptions()
149 149
     {
Please login to merge, or discard this patch.
Unused Use Statements   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,9 +2,9 @@
 block discarded – undo
2 2
 
3 3
 namespace Encore\Admin\Controllers;
4 4
 
5
-use Encore\Admin\Form;
6
-use Encore\Admin\Grid;
7
-use Encore\Admin\Show;
5
+use Encore\Admin\Form;
6
+use Encore\Admin\Grid;
7
+use Encore\Admin\Show;
8 8
 use Illuminate\Support\Str;
9 9
 
10 10
 class PermissionController extends AdminController
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
         $grid->column('slug', trans('admin.slug'));
33 33
         $grid->column('name', trans('admin.name'));
34 34
 
35
-        $grid->column('http_path', trans('admin.route'))->display(function ($path) {
36
-            return collect(explode("\n", $path))->map(function ($path) {
35
+        $grid->column('http_path', trans('admin.route'))->display(function($path) {
36
+            return collect(explode("\n", $path))->map(function($path) {
37 37
                 $method = $this->http_method ?: ['ANY'];
38 38
 
39 39
                 if (Str::contains($path, ':')) {
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
                     $method = explode(',', $method);
42 42
                 }
43 43
 
44
-                $method = collect($method)->map(function ($name) {
44
+                $method = collect($method)->map(function($name) {
45 45
                     return strtoupper($name);
46
-                })->map(function ($name) {
46
+                })->map(function($name) {
47 47
                     return "<span class='label label-primary'>{$name}</span>";
48 48
                 })->implode('&nbsp;');
49 49
 
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
         $grid->column('created_at', trans('admin.created_at'));
59 59
         $grid->column('updated_at', trans('admin.updated_at'));
60 60
 
61
-        $grid->tools(function (Grid\Tools $tools) {
62
-            $tools->batch(function (Grid\Tools\BatchActions $actions) {
61
+        $grid->tools(function(Grid\Tools $tools) {
62
+            $tools->batch(function(Grid\Tools\BatchActions $actions) {
63 63
                 $actions->disableDelete();
64 64
             });
65 65
         });
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
         $show->field('slug', trans('admin.slug'));
85 85
         $show->field('name', trans('admin.name'));
86 86
 
87
-        $show->field('http_path', trans('admin.route'))->unescape()->as(function ($path) {
88
-            return collect(explode("\r\n", $path))->map(function ($path) {
87
+        $show->field('http_path', trans('admin.route'))->unescape()->as(function($path) {
88
+            return collect(explode("\r\n", $path))->map(function($path) {
89 89
                 $method = $this->http_method ?: ['ANY'];
90 90
 
91 91
                 if (Str::contains($path, ':')) {
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
                     $method = explode(',', $method);
94 94
                 }
95 95
 
96
-                $method = collect($method)->map(function ($name) {
96
+                $method = collect($method)->map(function($name) {
97 97
                     return strtoupper($name);
98
-                })->map(function ($name) {
98
+                })->map(function($name) {
99 99
                     return "<span class='label label-primary'>{$name}</span>";
100 100
                 })->implode('&nbsp;');
101 101
 
Please login to merge, or discard this patch.
src/Controllers/RoleController.php 2 patches
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@
 block discarded – undo
2 2
 
3 3
 namespace Encore\Admin\Controllers;
4 4
 
5
-use Encore\Admin\Form;
6
-use Encore\Admin\Grid;
5
+use Encore\Admin\Form;
6
+use Encore\Admin\Grid;
7 7
 use Encore\Admin\Show;
8 8
 
9 9
 class RoleController extends AdminController
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,14 +36,14 @@  discard block
 block discarded – undo
36 36
         $grid->column('created_at', trans('admin.created_at'));
37 37
         $grid->column('updated_at', trans('admin.updated_at'));
38 38
 
39
-        $grid->actions(function (Grid\Displayers\Actions $actions) {
39
+        $grid->actions(function(Grid\Displayers\Actions $actions) {
40 40
             if ($actions->row->slug == 'administrator') {
41 41
                 $actions->disableDelete();
42 42
             }
43 43
         });
44 44
 
45
-        $grid->tools(function (Grid\Tools $tools) {
46
-            $tools->batch(function (Grid\Tools\BatchActions $actions) {
45
+        $grid->tools(function(Grid\Tools $tools) {
46
+            $tools->batch(function(Grid\Tools\BatchActions $actions) {
47 47
                 $actions->disableDelete();
48 48
             });
49 49
         });
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         $show->field('id', 'ID');
68 68
         $show->field('slug', trans('admin.slug'));
69 69
         $show->field('name', trans('admin.name'));
70
-        $show->field('permissions', trans('admin.permissions'))->as(function ($permission) {
70
+        $show->field('permissions', trans('admin.permissions'))->as(function($permission) {
71 71
             return $permission->pluck('name');
72 72
         })->label();
73 73
         $show->field('created_at', trans('admin.created_at'));
Please login to merge, or discard this patch.
src/Controllers/UserController.php 2 patches
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@
 block discarded – undo
2 2
 
3 3
 namespace Encore\Admin\Controllers;
4 4
 
5
-use Encore\Admin\Form;
6
-use Encore\Admin\Grid;
5
+use Encore\Admin\Form;
6
+use Encore\Admin\Grid;
7 7
 use Encore\Admin\Show;
8 8
 
9 9
 class UserController extends AdminController
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -34,14 +34,14 @@  discard block
 block discarded – undo
34 34
         $grid->column('created_at', trans('admin.created_at'));
35 35
         $grid->column('updated_at', trans('admin.updated_at'));
36 36
 
37
-        $grid->actions(function (Grid\Displayers\Actions $actions) {
37
+        $grid->actions(function(Grid\Displayers\Actions $actions) {
38 38
             if ($actions->getKey() == 1) {
39 39
                 $actions->disableDelete();
40 40
             }
41 41
         });
42 42
 
43
-        $grid->tools(function (Grid\Tools $tools) {
44
-            $tools->batch(function (Grid\Tools\BatchActions $actions) {
43
+        $grid->tools(function(Grid\Tools $tools) {
44
+            $tools->batch(function(Grid\Tools\BatchActions $actions) {
45 45
                 $actions->disableDelete();
46 46
             });
47 47
         });
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
         $show->field('id', 'ID');
66 66
         $show->field('username', trans('admin.username'));
67 67
         $show->field('name', trans('admin.name'));
68
-        $show->field('roles', trans('admin.roles'))->as(function ($roles) {
68
+        $show->field('roles', trans('admin.roles'))->as(function($roles) {
69 69
             return $roles->pluck('name');
70 70
         })->label();
71
-        $show->field('permissions', trans('admin.permissions'))->as(function ($permission) {
71
+        $show->field('permissions', trans('admin.permissions'))->as(function($permission) {
72 72
             return $permission->pluck('name');
73 73
         })->label();
74 74
         $show->field('created_at', trans('admin.created_at'));
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         $form->image('avatar', trans('admin.avatar'));
103 103
         $form->password('password', trans('admin.password'))->rules('required|confirmed');
104 104
         $form->password('password_confirmation', trans('admin.password_confirmation'))->rules('required')
105
-            ->default(function ($form) {
105
+            ->default(function($form) {
106 106
                 return $form->model()->password;
107 107
             });
108 108
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         $form->display('created_at', trans('admin.created_at'));
115 115
         $form->display('updated_at', trans('admin.updated_at'));
116 116
 
117
-        $form->saving(function (Form $form) {
117
+        $form->saving(function(Form $form) {
118 118
             if ($form->password && $form->model()->password != $form->password) {
119 119
                 $form->password = bcrypt($form->password);
120 120
             }
Please login to merge, or discard this patch.
src/Exception/Handler.php 1 patch
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 
3 3
 namespace Encore\Admin\Exception;
4 4
 
5
-use Illuminate\Support\MessageBag;
5
+use Illuminate\Support\MessageBag;
6 6
 use Illuminate\Support\ViewErrorBag;
7 7
 
8 8
 class Handler
Please login to merge, or discard this patch.
src/Extension.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -391,7 +391,7 @@
 block discarded – undo
391 391
      *
392 392
      * @param       $name
393 393
      * @param       $slug
394
-     * @param       $path
394
+     * @param       string $path
395 395
      * @param array $methods
396 396
      */
397 397
     protected static function createPermission($name, $slug, $path, $methods = [])
Please login to merge, or discard this patch.
Unused Use Statements   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -2,13 +2,13 @@
 block discarded – undo
2 2
 
3 3
 namespace Encore\Admin;
4 4
 
5
-use Encore\Admin\Auth\Database\Permission;
6
-use Illuminate\Database\Eloquent\Model;
7
-use Illuminate\Support\Arr;
8
-use Illuminate\Support\Facades\Config;
9
-use Illuminate\Support\Facades\DB;
10
-use Illuminate\Support\Facades\Route;
11
-use Illuminate\Support\Facades\Validator;
5
+use Encore\Admin\Auth\Database\Permission;
6
+use Illuminate\Database\Eloquent\Model;
7
+use Illuminate\Support\Arr;
8
+use Illuminate\Support\Facades\Config;
9
+use Illuminate\Support\Facades\DB;
10
+use Illuminate\Support\Facades\Route;
11
+use Illuminate\Support\Facades\Validator;
12 12
 use Illuminate\Validation\Rule;
13 13
 
14 14
 abstract class Extension
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -236,7 +236,7 @@
 block discarded – undo
236 236
     public static function import()
237 237
     {
238 238
         $extension = static::getInstance();
239
-        DB::transaction(function () use ($extension) {
239
+        DB::transaction(function() use ($extension) {
240 240
             if ($menu = $extension->menu()) {
241 241
                 if ($extension->validateMenu($menu)) {
242 242
                     extract($menu);
Please login to merge, or discard this patch.
src/Form.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
      *
516 516
      * @param array $data
517 517
      *
518
-     * @return mixed
518
+     * @return Response|null
519 519
      */
520 520
     protected function prepare($data = [])
521 521
     {
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
     /**
659 659
      * Get RedirectResponse after update.
660 660
      *
661
-     * @param mixed $key
661
+     * @param integer $key
662 662
      *
663 663
      * @return \Illuminate\Http\RedirectResponse
664 664
      */
Please login to merge, or discard this patch.
Unused Use Statements   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -2,25 +2,25 @@
 block discarded – undo
2 2
 
3 3
 namespace Encore\Admin;
4 4
 
5
-use Closure;
6
-use Encore\Admin\Exception\Handler;
7
-use Encore\Admin\Form\Builder;
8
-use Encore\Admin\Form\Field;
9
-use Encore\Admin\Form\HasHooks;
10
-use Encore\Admin\Form\Layout\Layout;
11
-use Encore\Admin\Form\Row;
12
-use Encore\Admin\Form\Tab;
13
-use Illuminate\Contracts\Support\Renderable;
14
-use Illuminate\Database\Eloquent\Model;
15
-use Illuminate\Database\Eloquent\Relations;
16
-use Illuminate\Database\Eloquent\SoftDeletes;
17
-use Illuminate\Http\Request;
18
-use Illuminate\Support\Arr;
19
-use Illuminate\Support\Facades\DB;
20
-use Illuminate\Support\MessageBag;
21
-use Illuminate\Support\Str;
22
-use Illuminate\Validation\Validator;
23
-use Spatie\EloquentSortable\Sortable;
5
+use Closure;
6
+use Encore\Admin\Exception\Handler;
7
+use Encore\Admin\Form\Builder;
8
+use Encore\Admin\Form\Field;
9
+use Encore\Admin\Form\HasHooks;
10
+use Encore\Admin\Form\Layout\Layout;
11
+use Encore\Admin\Form\Row;
12
+use Encore\Admin\Form\Tab;
13
+use Illuminate\Contracts\Support\Renderable;
14
+use Illuminate\Database\Eloquent\Model;
15
+use Illuminate\Database\Eloquent\Relations;
16
+use Illuminate\Database\Eloquent\SoftDeletes;
17
+use Illuminate\Http\Request;
18
+use Illuminate\Support\Arr;
19
+use Illuminate\Support\Facades\DB;
20
+use Illuminate\Support\MessageBag;
21
+use Illuminate\Support\Str;
22
+use Illuminate\Validation\Validator;
23
+use Spatie\EloquentSortable\Sortable;
24 24
 use Symfony\Component\HttpFoundation\Response;
25 25
 
26 26
 /**
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
                 return $ret;
368 368
             }
369 369
 
370
-            collect(explode(',', $id))->filter()->each(function ($id) {
370
+            collect(explode(',', $id))->filter()->each(function($id) {
371 371
                 $builder = $this->model()->newQuery();
372 372
 
373 373
                 if ($this->isSoftDeletes) {
@@ -420,9 +420,9 @@  discard block
 block discarded – undo
420 420
 
421 421
         $data = $model->toArray();
422 422
 
423
-        $this->builder->fields()->filter(function ($field) {
423
+        $this->builder->fields()->filter(function($field) {
424 424
             return $field instanceof Field\File;
425
-        })->each(function (Field\File $file) use ($data) {
425
+        })->each(function(Field\File $file) use ($data) {
426 426
             $file->setOriginal($data);
427 427
 
428 428
             $file->destroy();
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
             return $response;
448 448
         }
449 449
 
450
-        DB::transaction(function () {
450
+        DB::transaction(function() {
451 451
             $inserts = $this->prepareInsert($this->updates);
452 452
 
453 453
             foreach ($inserts as $column => $value) {
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
             return $response;
618 618
         }
619 619
 
620
-        DB::transaction(function () {
620
+        DB::transaction(function() {
621 621
             $updates = $this->prepareUpdate($this->updates);
622 622
 
623 623
             foreach ($updates as $column => $value) {
@@ -1097,7 +1097,7 @@  discard block
 block discarded – undo
1097 1097
     protected function getFieldByColumn($column)
1098 1098
     {
1099 1099
         return $this->builder->fields()->first(
1100
-            function (Field $field) use ($column) {
1100
+            function(Field $field) use ($column) {
1101 1101
                 if (is_array($field->column())) {
1102 1102
                     return in_array($column, $field->column());
1103 1103
                 }
@@ -1118,7 +1118,7 @@  discard block
 block discarded – undo
1118 1118
 
1119 1119
         $values = $this->model->toArray();
1120 1120
 
1121
-        $this->builder->fields()->each(function (Field $field) use ($values) {
1121
+        $this->builder->fields()->each(function(Field $field) use ($values) {
1122 1122
             $field->setOriginal($values);
1123 1123
         });
1124 1124
     }
@@ -1148,7 +1148,7 @@  discard block
 block discarded – undo
1148 1148
 
1149 1149
         $data = $this->model->toArray();
1150 1150
 
1151
-        $this->builder->fields()->each(function (Field $field) use ($data) {
1151
+        $this->builder->fields()->each(function(Field $field) use ($data) {
1152 1152
             if (!in_array($field->column(), $this->ignored)) {
1153 1153
                 $field->fill($data);
1154 1154
             }
@@ -1292,7 +1292,7 @@  discard block
 block discarded – undo
1292 1292
      */
1293 1293
     public function setWidth($fieldWidth = 8, $labelWidth = 2)
1294 1294
     {
1295
-        $this->builder()->fields()->each(function ($field) use ($fieldWidth, $labelWidth) {
1295
+        $this->builder()->fields()->each(function($field) use ($fieldWidth, $labelWidth) {
1296 1296
             /* @var Field $field  */
1297 1297
             $field->setWidth($fieldWidth, $labelWidth);
1298 1298
         });
Please login to merge, or discard this patch.