Completed
Branch master (a13a77)
by Song
02:37
created
src/Controllers/UserController.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      */
22 22
     public function index()
23 23
     {
24
-        return Admin::content(function (Content $content) {
24
+        return Admin::content(function(Content $content) {
25 25
             $content->header(trans('admin::lang.administrator'));
26 26
             $content->description(trans('admin::lang.list'));
27 27
             $content->body($this->grid()->render());
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function edit($id)
39 39
     {
40
-        return Admin::content(function (Content $content) use ($id) {
40
+        return Admin::content(function(Content $content) use ($id) {
41 41
             $content->header(trans('admin::lang.administrator'));
42 42
             $content->description(trans('admin::lang.edit'));
43 43
             $content->body($this->form()->edit($id));
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      */
52 52
     public function create()
53 53
     {
54
-        return Admin::content(function (Content $content) {
54
+        return Admin::content(function(Content $content) {
55 55
             $content->header(trans('admin::lang.administrator'));
56 56
             $content->description(trans('admin::lang.create'));
57 57
             $content->body($this->form());
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
      */
66 66
     protected function grid()
67 67
     {
68
-        return Admin::grid(Administrator::class, function (Grid $grid) {
68
+        return Admin::grid(Administrator::class, function(Grid $grid) {
69 69
             $grid->id('ID')->sortable();
70 70
             $grid->username(trans('admin::lang.username'));
71 71
             $grid->name(trans('admin::lang.name'));
72 72
 
73
-            $grid->roles(trans('admin::lang.roles'))->value(function ($roles) {
74
-                $roles = array_map(function ($role) {
73
+            $grid->roles(trans('admin::lang.roles'))->value(function($roles) {
74
+                $roles = array_map(function($role) {
75 75
                     return "<span class='label label-success'>{$role['name']}</span>";
76 76
                 }, $roles);
77 77
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
             $grid->created_at(trans('admin::lang.created_at'));
82 82
             $grid->updated_at(trans('admin::lang.updated_at'));
83 83
 
84
-            $grid->rows(function ($row) {
84
+            $grid->rows(function($row) {
85 85
                 if ($row->id == 1) {
86 86
                     $row->actions('edit');
87 87
                 }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      */
97 97
     public function form()
98 98
     {
99
-        return Admin::form(Administrator::class, function (Form $form) {
99
+        return Admin::form(Administrator::class, function(Form $form) {
100 100
             $form->display('id', 'ID');
101 101
 
102 102
             $form->text('username', trans('admin::lang.username'))->rules('required');
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             $form->display('created_at', trans('admin::lang.created_at'));
109 109
             $form->display('updated_at', trans('admin::lang.updated_at'));
110 110
 
111
-            $form->saving(function (Form $form) {
111
+            $form->saving(function(Form $form) {
112 112
                 if ($form->password && $form->model()->password != $form->password) {
113 113
                     $form->password = bcrypt($form->password);
114 114
                 }
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
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      */
22 22
     public function index()
23 23
     {
24
-        return Admin::content(function (Content $content) {
24
+        return Admin::content(function(Content $content) {
25 25
             $content->header(trans('admin::lang.roles'));
26 26
             $content->description(trans('admin::lang.list'));
27 27
             $content->body($this->grid()->render());
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function edit($id)
39 39
     {
40
-        return Admin::content(function (Content $content) use ($id) {
40
+        return Admin::content(function(Content $content) use ($id) {
41 41
             $content->header(trans('admin::lang.roles'));
42 42
             $content->description(trans('admin::lang.edit'));
43 43
             $content->body($this->form()->edit($id));
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      */
52 52
     public function create()
53 53
     {
54
-        return Admin::content(function (Content $content) {
54
+        return Admin::content(function(Content $content) {
55 55
             $content->header(trans('admin::lang.roles'));
56 56
             $content->description(trans('admin::lang.create'));
57 57
             $content->body($this->form());
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     protected function grid()
67 67
     {
68
-        return Admin::grid(Role::class, function (Grid $grid) {
68
+        return Admin::grid(Role::class, function(Grid $grid) {
69 69
             $grid->id('ID')->sortable();
70 70
             $grid->slug(trans('admin::lang.slug'));
71 71
             $grid->name(trans('admin::lang.name'));
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
             $grid->created_at(trans('admin::lang.created_at'));
74 74
             $grid->updated_at(trans('admin::lang.updated_at'));
75 75
 
76
-            $grid->rows(function ($row) {
76
+            $grid->rows(function($row) {
77 77
                 if ($row->slug == 'administrator') {
78 78
                     $row->actions('edit');
79 79
                 }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
      */
89 89
     public function form()
90 90
     {
91
-        return Admin::form(Role::class, function (Form $form) {
91
+        return Admin::form(Role::class, function(Form $form) {
92 92
             $form->display('id', 'ID');
93 93
 
94 94
             $form->text('slug', trans('admin::lang.slug'))->rules('required');
Please login to merge, or discard this patch.
src/Form.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -231,9 +231,9 @@  discard block
 block discarded – undo
231 231
         $data = $this->model->with($this->getRelations())
232 232
             ->findOrFail($id)->toArray();
233 233
 
234
-        $this->builder->fields()->filter(function ($field) {
234
+        $this->builder->fields()->filter(function($field) {
235 235
             return $field instanceof Field\File;
236
-        })->each(function (File $file) use ($data) {
236
+        })->each(function(File $file) use ($data) {
237 237
             $file->setOriginal($data);
238 238
 
239 239
             $file->destroy();
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 
256 256
         $this->prepare($data, $this->saving);
257 257
 
258
-        DB::transaction(function () {
258
+        DB::transaction(function() {
259 259
             $inserts = $this->prepareInsert($this->updates);
260 260
 
261 261
             foreach ($inserts as $column => $value) {
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 
294 294
         $updates = array_except($this->inputs, array_keys($this->relations));
295 295
 
296
-        $this->updates = array_filter($updates, function ($val) {
296
+        $this->updates = array_filter($updates, function($val) {
297 297
             return !is_null($val);
298 298
         });
299 299
     }
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 
391 391
         $this->prepare($data, $this->saving);
392 392
 
393
-        DB::transaction(function () {
393
+        DB::transaction(function() {
394 394
             $updates = $this->prepareUpdate($this->updates);
395 395
 
396 396
             foreach ($updates as $column => $value) {
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
     protected function getFieldByColumn($column)
591 591
     {
592 592
         return $this->builder->fields()->first(
593
-            function ($index, Field $field) use ($column) {
593
+            function($index, Field $field) use ($column) {
594 594
                 if (is_array($field->column())) {
595 595
                     return in_array($column, $field->column());
596 596
                 }
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
     {
610 610
         $values = $this->model->toArray();
611 611
 
612
-        $this->builder->fields()->each(function (Field $field) use ($values) {
612
+        $this->builder->fields()->each(function(Field $field) use ($values) {
613 613
             $field->setOriginal($values);
614 614
         });
615 615
     }
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
 
630 630
         $data = $this->model->toArray();
631 631
 
632
-        $this->builder->fields()->each(function (Field $field) use ($data) {
632
+        $this->builder->fields()->each(function(Field $field) use ($data) {
633 633
             $field->fill($data);
634 634
         });
635 635
     }
Please login to merge, or discard this patch.
Doc Comments   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
      *
205 205
      * @param $id
206 206
      *
207
-     * @return mixed
207
+     * @return boolean
208 208
      */
209 209
     public function destroy($id)
210 210
     {
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
      * Prepare input data for insert or update.
280 280
      *
281 281
      * @param array    $data
282
-     * @param callable $callback
282
+     * @param Closure $callback
283 283
      */
284 284
     protected function prepare($data = [], Closure $callback = null)
285 285
     {
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
      *
377 377
      * @param int $id
378 378
      *
379
-     * @return $this|\Illuminate\Http\RedirectResponse
379
+     * @return \Symfony\Component\HttpFoundation\Response
380 380
      */
381 381
     public function update($id)
382 382
     {
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
      * @param int   $id
446 446
      * @param array $input
447 447
      *
448
-     * @return array
448
+     * @return boolean
449 449
      */
450 450
     protected function handleOrderable($id, array $input = [])
451 451
     {
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
     /**
586 586
      * Set saving callback.
587 587
      *
588
-     * @param callable $callback
588
+     * @param Closure $callback
589 589
      *
590 590
      * @return void
591 591
      */
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
     /**
598 598
      * Set saved callback.
599 599
      *
600
-     * @param callable $callback
600
+     * @param Closure $callback
601 601
      *
602 602
      * @return void
603 603
      */
@@ -853,6 +853,9 @@  discard block
 block discarded – undo
853 853
         }
854 854
     }
855 855
 
856
+    /**
857
+     * @param string $method
858
+     */
856 859
     public static function findFieldClass($method)
857 860
     {
858 861
         $className = __NAMESPACE__.'\\Form\\Field\\'.ucfirst($method);
Please login to merge, or discard this patch.
migrations/2016_01_04_173148_create_admin_tables.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
      */
13 13
     public function up()
14 14
     {
15
-        Schema::create(config('admin.database.users_table'), function (Blueprint $table) {
15
+        Schema::create(config('admin.database.users_table'), function(Blueprint $table) {
16 16
             $table->increments('id');
17 17
             $table->string('username', 190)->unique();
18 18
             $table->string('password', 60);
@@ -21,21 +21,21 @@  discard block
 block discarded – undo
21 21
             $table->timestamps();
22 22
         });
23 23
 
24
-        Schema::create(config('admin.database.roles_table'), function (Blueprint $table) {
24
+        Schema::create(config('admin.database.roles_table'), function(Blueprint $table) {
25 25
             $table->increments('id');
26 26
             $table->string('name', 50)->unique();
27 27
             $table->string('slug', 50);
28 28
             $table->timestamps();
29 29
         });
30 30
 
31
-        Schema::create(config('admin.database.permissions_table'), function (Blueprint $table) {
31
+        Schema::create(config('admin.database.permissions_table'), function(Blueprint $table) {
32 32
             $table->increments('id');
33 33
             $table->string('name', 50)->unique();
34 34
             $table->string('slug', 50);
35 35
             $table->timestamps();
36 36
         });
37 37
 
38
-        Schema::create(config('admin.database.menu_table'), function (Blueprint $table) {
38
+        Schema::create(config('admin.database.menu_table'), function(Blueprint $table) {
39 39
             $table->increments('id');
40 40
             $table->integer('parent_id')->default(0);
41 41
             $table->integer('order');
@@ -46,28 +46,28 @@  discard block
 block discarded – undo
46 46
             $table->timestamps();
47 47
         });
48 48
 
49
-        Schema::create(config('admin.database.role_users_table'), function (Blueprint $table) {
49
+        Schema::create(config('admin.database.role_users_table'), function(Blueprint $table) {
50 50
             $table->integer('role_id');
51 51
             $table->integer('user_id');
52 52
             $table->index(['role_id', 'user_id']);
53 53
             $table->timestamps();
54 54
         });
55 55
 
56
-        Schema::create(config('admin.database.role_permissions_table'), function (Blueprint $table) {
56
+        Schema::create(config('admin.database.role_permissions_table'), function(Blueprint $table) {
57 57
             $table->integer('role_id');
58 58
             $table->integer('permission_id');
59 59
             $table->index(['role_id', 'permission_id']);
60 60
             $table->timestamps();
61 61
         });
62 62
 
63
-        Schema::create(config('admin.database.role_menu_table'), function (Blueprint $table) {
63
+        Schema::create(config('admin.database.role_menu_table'), function(Blueprint $table) {
64 64
             $table->integer('role_id');
65 65
             $table->integer('menu_id');
66 66
             $table->index(['role_id', 'menu_id']);
67 67
             $table->timestamps();
68 68
         });
69 69
 
70
-        Schema::create(config('admin.database.operation_log_table'), function (Blueprint $table) {
70
+        Schema::create(config('admin.database.operation_log_table'), function(Blueprint $table) {
71 71
             $table->increments('id');
72 72
             $table->integer('user_id');
73 73
             $table->string('path');
Please login to merge, or discard this patch.
src/Controllers/LogController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,23 +18,23 @@  discard block
 block discarded – undo
18 18
      */
19 19
     public function index()
20 20
     {
21
-        return Admin::content(function (Content $content) {
21
+        return Admin::content(function(Content $content) {
22 22
             $content->header(trans('admin::lang.operation_log'));
23 23
             $content->description(trans('admin::lang.list'));
24 24
 
25
-            $grid = Admin::grid(OperationLog::class, function (Grid $grid) {
25
+            $grid = Admin::grid(OperationLog::class, function(Grid $grid) {
26 26
                 $grid->model()->orderBy('id', 'DESC');
27 27
 
28 28
                 $grid->id('ID')->sortable();
29 29
                 $grid->user()->name();
30
-                $grid->method()->value(function ($method) {
30
+                $grid->method()->value(function($method) {
31 31
                     $color = array_get(OperationLog::$methodColors, $method, 'grey');
32 32
 
33 33
                     return "<span class=\"badge bg-$color\">$method</span>";
34 34
                 });
35 35
                 $grid->path()->label('info');
36 36
                 $grid->ip()->label('primary');
37
-                $grid->input()->value(function ($input) {
37
+                $grid->input()->value(function($input) {
38 38
                     $input = json_decode($input, true);
39 39
                     $input = array_except($input, '_pjax');
40 40
 
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
 
44 44
                 $grid->created_at(trans('admin::lang.created_at'));
45 45
 
46
-                $grid->rows(function ($row) {
46
+                $grid->rows(function($row) {
47 47
                     $row->actions('delete');
48 48
                 });
49 49
 
50
-                $grid->filter(function ($filter) {
50
+                $grid->filter(function($filter) {
51 51
                     $filter->is('user_id', 'User')->select(Administrator::all()->pluck('name', 'id'));
52 52
                     $filter->is('method')->select(array_combine(OperationLog::$methods, OperationLog::$methods));
53 53
                     $filter->like('path');
Please login to merge, or discard this patch.
src/Controllers/MenuController.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,12 +23,12 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public function index()
25 25
     {
26
-        return Admin::content(function (Content $content) {
26
+        return Admin::content(function(Content $content) {
27 27
             $content->header(trans('admin::lang.menu'));
28 28
             $content->description(trans('admin::lang.list'));
29 29
 
30
-            $content->row(function (Row $row) {
31
-                $row->column(5, function (Column $column) {
30
+            $content->row(function(Row $row) {
31
+                $row->column(5, function(Column $column) {
32 32
                     $column->append($this->callout());
33 33
 
34 34
                     $form = new \Encore\Admin\Widgets\Form();
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
      */
63 63
     public function edit($id)
64 64
     {
65
-        return Admin::content(function (Content $content) use ($id) {
65
+        return Admin::content(function(Content $content) use ($id) {
66 66
             $content->header(trans('admin::lang.menu'));
67 67
             $content->description(trans('admin::lang.edit'));
68 68
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      */
117 117
     public function form()
118 118
     {
119
-        return Admin::form(MenuModel::class, function (Form $form) {
119
+        return Admin::form(MenuModel::class, function(Form $form) {
120 120
             $form->display('id', 'ID');
121 121
 
122 122
             $options = [0 => 'Root'] + MenuModel::buildSelectOptions();
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@
 block discarded – undo
74 74
     /**
75 75
      * @param $id
76 76
      *
77
-     * @return $this|\Illuminate\Http\RedirectResponse
77
+     * @return \Symfony\Component\HttpFoundation\Response
78 78
      */
79 79
     public function update($id)
80 80
     {
Please login to merge, or discard this patch.
src/Grid/Exporter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
      */
69 69
     protected function sanitize(array $row)
70 70
     {
71
-        return collect($row)->reject(function ($val, $_) {
71
+        return collect($row)->reject(function($val, $_) {
72 72
 
73 73
             return is_array($val) && !Arr::isAssoc($val);
74 74
 
Please login to merge, or discard this patch.
src/Form/Field.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
     /**
249 249
      * Get or set rules.
250 250
      *
251
-     * @param null $rules
251
+     * @param string $rules
252 252
      *
253 253
      * @return $this
254 254
      */
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
     /**
269 269
      * Set or get value of the field.
270 270
      *
271
-     * @param null $value
271
+     * @param string $value
272 272
      *
273 273
      * @return mixed
274 274
      */
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,6 @@
 block discarded – undo
5 5
 use Encore\Admin\Admin;
6 6
 use Encore\Admin\Form;
7 7
 use Illuminate\Contracts\Support\Arrayable;
8
-use Illuminate\Support\Facades\Input;
9 8
 
10 9
 /**
11 10
  * Class Field.
Please login to merge, or discard this patch.
src/Widgets/Callout.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
     /**
25 25
      * Callout constructor.
26 26
      *
27
-     * @param $content
27
+     * @param string $content
28 28
      * @param string $title
29 29
      * @param string $style
30 30
      */
Please login to merge, or discard this patch.