Completed
Pull Request — master (#5883)
by
unknown
28s
created
src/Actions/RowSimpleAction.php 1 patch
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -61,8 +61,9 @@  discard block
 block discarded – undo
61 61
     private function renderDefault(): void
62 62
     {
63 63
         $render_key = get_called_class().'-default';
64
-        if (array_key_exists($render_key, static::$is_rendered))
65
-            return;
64
+        if (array_key_exists($render_key, static::$is_rendered)) {
65
+                    return;
66
+        }
66 67
         static::$is_rendered[$render_key] = true;
67 68
 
68 69
         $parameters = json_encode($this->parameters());
@@ -106,8 +107,9 @@  discard block
 block discarded – undo
106 107
         }
107 108
 
108 109
         $render_key = get_called_class().'-dialog';
109
-        if (array_key_exists($render_key, static::$is_rendered))
110
-            return;
110
+        if (array_key_exists($render_key, static::$is_rendered)) {
111
+                    return;
112
+        }
111 113
         static::$is_rendered[$render_key] = true;
112 114
 
113 115
         $parameters = json_encode($this->parameters());
@@ -178,8 +180,9 @@  discard block
 block discarded – undo
178 180
                 'label' => $row['label'],
179 181
             ];
180 182
 
181
-            if (!empty($row['rules']) && in_array('required', $row['rules']))
182
-                $tmp['is_required'] = 1;
183
+            if (!empty($row['rules']) && in_array('required', $row['rules'])) {
184
+                            $tmp['is_required'] = 1;
185
+            }
183 186
 
184 187
             if (array_key_exists('options', $row)) {
185 188
                 if (empty(static::$select_options)) {
@@ -201,8 +204,9 @@  discard block
 block discarded – undo
201 204
             $props[] = $tmp;
202 205
         }
203 206
 
204
-        if (!empty($props))
205
-            $this->attribute('data-props', json_encode($props, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
207
+        if (!empty($props)) {
208
+                    $this->attribute('data-props', json_encode($props, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
209
+        }
206 210
 
207 211
         $confirm = (new \ReflectionClass($this->interactor))->getProperty('confirm')->getValue($this->interactor);
208 212
         if (!empty($confirm)) {
@@ -210,8 +214,9 @@  discard block
 block discarded – undo
210 214
         }
211 215
 
212 216
         $render_key = get_called_class().'-form';
213
-        if (array_key_exists($render_key, static::$is_rendered))
214
-            return;
217
+        if (array_key_exists($render_key, static::$is_rendered)) {
218
+                    return;
219
+        }
215 220
         static::$is_rendered[$render_key] = true;
216 221
 
217 222
         $this->interactor->addModalHtml();
Please login to merge, or discard this patch.
src/Grid/Displayers/Copyable.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,8 +31,9 @@
 block discarded – undo
31 31
     public function display(): string
32 32
     {
33 33
         $content = $this->getColumn()->getOriginal();
34
-        if (is_null($content) || $content === '')
35
-            return '';
34
+        if (is_null($content) || $content === '') {
35
+                    return '';
36
+        }
36 37
 
37 38
         $this->addScript();
38 39
 
Please login to merge, or discard this patch.
src/Grid/Exporters/CsvExporter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -168,16 +168,16 @@  discard block
 block discarded – undo
168 168
             call_user_func($this->callback, $this);
169 169
         }
170 170
 
171
-        $response = function () {
171
+        $response = function() {
172 172
             $handle = fopen('php://output', 'w');
173 173
             $titles = [];
174 174
             fwrite($handle, chr(0xEF).chr(0xBB).chr(0xBF));
175
-            $this->chunk(function ($collection) use ($handle, &$titles) {
175
+            $this->chunk(function($collection) use ($handle, &$titles) {
176 176
                 Column::setOriginalGridModels($collection);
177 177
 
178 178
                 $original = $current = $collection->toArray();
179 179
 
180
-                $this->grid->getColumns()->map(function (Column $column) use (&$current) {
180
+                $this->grid->getColumns()->map(function(Column $column) use (&$current) {
181 181
                     $current = $column->fill($current);
182 182
                     $this->grid->columnNames[] = $column->getName();
183 183
                 });
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
     protected function getVisiableTitles()
207 207
     {
208 208
         $titles = $this->grid->visibleColumns()
209
-            ->mapWithKeys(function (Column $column) {
209
+            ->mapWithKeys(function(Column $column) {
210 210
                 $columnName = $column->getName();
211 211
                 $columnTitle = $column->getLabel();
212 212
                 if (isset($this->titleCallbacks[$columnName])) {
Please login to merge, or discard this patch.
src/Console/ResourceGenerator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -240,7 +240,7 @@
 block discarded – undo
240 240
     {
241 241
         $connection = $this->model->getConnection();
242 242
 
243
-        return $connection->getSchemaBuilder()->getColumns($connection->getTablePrefix() . $this->model->getTable());
243
+        return $connection->getSchemaBuilder()->getColumns($connection->getTablePrefix().$this->model->getTable());
244 244
     }
245 245
 
246 246
     /**
Please login to merge, or discard this patch.
src/Controllers/MenuController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
         return $content
28 28
             ->title(trans('admin.menu'))
29 29
             ->description(trans('admin.list'))
30
-            ->row(function (Row $row) {
30
+            ->row(function(Row $row) {
31 31
                 $row->column(6, $this->treeView()->render());
32 32
 
33
-                $row->column(6, function (Column $column) {
33
+                $row->column(6, function(Column $column) {
34 34
                     $form = new \Encore\Admin\Widgets\Form();
35 35
                     $form->action(admin_url('auth/menu'));
36 36
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
         $tree->disableCreate();
78 78
 
79
-        $tree->branch(function ($branch) {
79
+        $tree->branch(function($branch) {
80 80
             $payload = "<i class='fa {$branch['icon']}'></i>&nbsp;<strong>{$branch['title']}</strong>";
81 81
 
82 82
             if (!isset($branch['children'])) {
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         $form->display('created_at', trans('admin.created_at'));
139 139
         $form->display('updated_at', trans('admin.updated_at'));
140 140
 
141
-        $form->saved(function (Form $form) {
141
+        $form->saved(function(Form $form) {
142 142
             Admin::clearCache();
143 143
         });
144 144
 
Please login to merge, or discard this patch.
src/Controllers/RoleController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,21 +32,21 @@  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('permissions', trans('admin.permission'))->pluck('name')->label()->display(function ($raw) {
35
+        $grid->column('permissions', trans('admin.permission'))->pluck('name')->label()->display(function($raw) {
36 36
             return str_replace('&nbsp;', '<br>', $raw);
37 37
         });
38 38
 
39 39
         $grid->column('created_at', trans('admin.created_at'));
40 40
         $grid->column('updated_at', trans('admin.updated_at'));
41 41
 
42
-        $grid->actions(function (Grid\Displayers\Actions $actions) {
42
+        $grid->actions(function(Grid\Displayers\Actions $actions) {
43 43
             if ($actions->row->slug == 'administrator') {
44 44
                 $actions->disableDelete();
45 45
             }
46 46
         });
47 47
 
48
-        $grid->tools(function (Grid\Tools $tools) {
49
-            $tools->batch(function (Grid\Tools\BatchActions $actions) {
48
+        $grid->tools(function(Grid\Tools $tools) {
49
+            $tools->batch(function(Grid\Tools\BatchActions $actions) {
50 50
                 $actions->disableDelete();
51 51
             });
52 52
         });
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
         $show->field('id', 'ID');
71 71
         $show->field('slug', trans('admin.slug'));
72 72
         $show->field('name', trans('admin.name'));
73
-        $show->field('permissions', trans('admin.permissions'))->as(function ($permission) {
73
+        $show->field('permissions', trans('admin.permissions'))->as(function($permission) {
74 74
             return $permission->pluck('name');
75 75
         })->label();
76 76
         $show->field('created_at', trans('admin.created_at'));
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         $form->display('created_at', trans('admin.created_at'));
101 101
         $form->display('updated_at', trans('admin.updated_at'));
102 102
 
103
-        $form->saved(function (Form $form) {
103
+        $form->saved(function(Form $form) {
104 104
             Admin::clearCache();
105 105
         });
106 106
 
Please login to merge, or discard this patch.
src/Controllers/AuthController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
     {
103 103
         $form = $this->settingForm();
104 104
         $form->tools(
105
-            function (Form\Tools $tools) {
105
+            function(Form\Tools $tools) {
106 106
                 $tools->disableList();
107 107
                 $tools->disableDelete();
108 108
                 $tools->disableView();
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
         $form->image('avatar', trans('admin.avatar'));
141 141
         $form->password('password', trans('admin.password'))->rules('confirmed|required');
142 142
         $form->password('password_confirmation', trans('admin.password_confirmation'))->rules('required')
143
-            ->default(function ($form) {
143
+            ->default(function($form) {
144 144
                 return $form->model()->password;
145 145
             });
146 146
 
@@ -148,13 +148,13 @@  discard block
 block discarded – undo
148 148
 
149 149
         $form->ignore(['password_confirmation']);
150 150
 
151
-        $form->saving(function (Form $form) {
151
+        $form->saving(function(Form $form) {
152 152
             if ($form->password && $form->model()->password != $form->password) {
153 153
                 $form->password = Hash::make($form->password);
154 154
             }
155 155
         });
156 156
 
157
-        $form->saved(function () {
157
+        $form->saved(function() {
158 158
             admin_toastr(trans('admin.update_succeeded'));
159 159
 
160 160
             return redirect(admin_url('auth/setting'));
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
         return Admin::guard();
224 224
     }
225 225
 
226
-    public function show2FaForm(Request $request): View|RedirectResponse
226
+    public function show2FaForm(Request $request): View | RedirectResponse
227 227
     {
228 228
         $user = Admin::user();
229 229
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
         return view('admin::google2fa.index');
263 263
     }
264 264
 
265
-    public function set2Fa(Request $request): View|RedirectResponse
265
+    public function set2Fa(Request $request): View | RedirectResponse
266 266
     {
267 267
         $user = Admin::user();
268 268
 
Please login to merge, or discard this patch.
src/Controllers/PermissionController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
         $grid->column('slug', trans('admin.slug'));
34 34
         $grid->column('name', trans('admin.name'));
35 35
 
36
-        $grid->column('http_path', trans('admin.route'))->display(function ($path) {
37
-            return collect(explode("\n", $path))->map(function ($path) {
36
+        $grid->column('http_path', trans('admin.route'))->display(function($path) {
37
+            return collect(explode("\n", $path))->map(function($path) {
38 38
                 $method = $this->http_method ?: ['ANY'];
39 39
 
40 40
                 if (Str::contains($path, ':')) {
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
                     $method = explode(',', $method);
43 43
                 }
44 44
 
45
-                $method = collect($method)->map(function ($name) {
45
+                $method = collect($method)->map(function($name) {
46 46
                     return strtoupper($name);
47
-                })->map(function ($name) {
47
+                })->map(function($name) {
48 48
                     return "<span class='label label-primary'>{$name}</span>";
49 49
                 })->implode('&nbsp;');
50 50
 
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
         $grid->column('created_at', trans('admin.created_at'));
60 60
         $grid->column('updated_at', trans('admin.updated_at'));
61 61
 
62
-        $grid->tools(function (Grid\Tools $tools) {
63
-            $tools->batch(function (Grid\Tools\BatchActions $actions) {
62
+        $grid->tools(function(Grid\Tools $tools) {
63
+            $tools->batch(function(Grid\Tools\BatchActions $actions) {
64 64
                 $actions->disableDelete();
65 65
             });
66 66
         });
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
         $show->field('slug', trans('admin.slug'));
86 86
         $show->field('name', trans('admin.name'));
87 87
 
88
-        $show->field('http_path', trans('admin.route'))->unescape()->as(function ($path) {
89
-            return collect(explode("\r\n", $path))->map(function ($path) {
88
+        $show->field('http_path', trans('admin.route'))->unescape()->as(function($path) {
89
+            return collect(explode("\r\n", $path))->map(function($path) {
90 90
                 $method = $this->http_method ?: ['ANY'];
91 91
 
92 92
                 if (Str::contains($path, ':')) {
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
                     $method = explode(',', $method);
95 95
                 }
96 96
 
97
-                $method = collect($method)->map(function ($name) {
97
+                $method = collect($method)->map(function($name) {
98 98
                     return strtoupper($name);
99
-                })->map(function ($name) {
99
+                })->map(function($name) {
100 100
                     return "<span class='label label-primary'>{$name}</span>";
101 101
                 })->implode('&nbsp;');
102 102
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         $form->display('created_at', trans('admin.created_at'));
139 139
         $form->display('updated_at', trans('admin.updated_at'));
140 140
 
141
-        $form->saved(function (Form $form) {
141
+        $form->saved(function(Form $form) {
142 142
             Admin::clearCache();
143 143
         });
144 144
 
Please login to merge, or discard this patch.
src/Controllers/UserController.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -42,23 +42,23 @@  discard block
 block discarded – undo
42 42
         $grid->column('created_at', trans('admin.created_at'));
43 43
         $grid->column('updated_at', trans('admin.updated_at'));
44 44
 
45
-        $grid->actions(function (Grid\Displayers\Actions $actions) {
45
+        $grid->actions(function(Grid\Displayers\Actions $actions) {
46 46
             if ($actions->getKey() == 1) {
47 47
                 $actions->disableDelete();
48 48
             }
49 49
         });
50 50
 
51
-        $grid->tools(function (Grid\Tools $tools) {
52
-            $tools->batch(function (Grid\Tools\BatchActions $actions) {
51
+        $grid->tools(function(Grid\Tools $tools) {
52
+            $tools->batch(function(Grid\Tools\BatchActions $actions) {
53 53
                 $actions->disableDelete();
54 54
             });
55 55
         });
56 56
 
57 57
         $grid->filter(function($filter) {
58
-            $filter->column(1/2, function ($filter) {
58
+            $filter->column(1 / 2, function($filter) {
59 59
                 $filter->like('username', trans('admin.username'));
60 60
                 $filter->like('name', trans('admin.name'));
61
-                $filter->where(function ($query) {
61
+                $filter->where(function($query) {
62 62
                     $user_ids = DB::table(config('admin.database.role_users_table'))
63 63
                         ->where('role_id', $this->input)
64 64
                         ->pluck('user_id')->toArray();
@@ -67,15 +67,15 @@  discard block
 block discarded – undo
67 67
                     Role::pluck('name', 'id')->toArray()
68 68
                 );
69 69
             });
70
-            $filter->column(1/2, function ($filter) {
70
+            $filter->column(1 / 2, function($filter) {
71 71
                 $filter->bool('is_blocked', true, trans('admin.ext.is_blocked'));
72 72
                 $filter->bool('is_google2fa', true, trans('admin.ext.is_google2fa'));
73 73
             });
74 74
         });
75 75
 
76
-        $grid->export(function ($export) {
76
+        $grid->export(function($export) {
77 77
             $export->originalValue(['is_blocked', 'is_need_relogin', 'is_google2fa']);
78
-            $export->column('roles', function ($value) {
78
+            $export->column('roles', function($value) {
79 79
                 return $value ? str_replace('&nbsp;', ', ', strip_tags($value)) : '';
80 80
             });
81 81
         });
@@ -99,10 +99,10 @@  discard block
 block discarded – undo
99 99
         $show->field('id', 'ID');
100 100
         $show->field('username', trans('admin.username'));
101 101
         $show->field('name', trans('admin.name'));
102
-        $show->field('roles', trans('admin.roles'))->as(function ($roles) {
102
+        $show->field('roles', trans('admin.roles'))->as(function($roles) {
103 103
             return $roles->pluck('name');
104 104
         })->label();
105
-        $show->field('permissions', trans('admin.permissions'))->as(function ($permission) {
105
+        $show->field('permissions', trans('admin.permissions'))->as(function($permission) {
106 106
             return $permission->pluck('name');
107 107
         })->label();
108 108
         $show->field('is_blocked', trans('admin.ext.is_blocked'))->check();
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         $form->image('avatar', trans('admin.avatar'));
142 142
         $form->password('password', trans('admin.password'))->rules('required|confirmed');
143 143
         $form->password('password_confirmation', trans('admin.password_confirmation'))->rules('required')
144
-            ->default(function ($form) {
144
+            ->default(function($form) {
145 145
                 return $form->model()->password;
146 146
             });
147 147
 
@@ -163,13 +163,13 @@  discard block
 block discarded – undo
163 163
         $form->display('created_at', trans('admin.created_at'));
164 164
         $form->display('updated_at', trans('admin.updated_at'));
165 165
 
166
-        $form->saving(function (Form $form) {
166
+        $form->saving(function(Form $form) {
167 167
             if ($form->password && $form->model()->password != $form->password) {
168 168
                 $form->password = Hash::make($form->password);
169 169
             }
170 170
         });
171 171
 
172
-        $form->saved(function (Form $form) {
172
+        $form->saved(function(Form $form) {
173 173
             Admin::clearCache();
174 174
         });
175 175
 
Please login to merge, or discard this patch.