jqh 6 lat temu
rodzic
commit
ed995655e6
83 zmienionych plików z 447 dodań i 388 usunięć
  1. 1 1
      resources/views/index.blade.php
  2. 0 1
      src/Form.php
  3. 1 1
      src/Form/Field/SelectResource.php
  4. 0 1
      src/Form/Field/SwitchField.php
  5. 1 0
      src/Form/Field/Text.php
  6. 29 20
      src/Form/Field/UploadField.php
  7. 9 4
      src/Form/Field/WebUploader.php
  8. 2 3
      src/Form/Footer.php
  9. 6 6
      src/Form/Layout.php
  10. 2 1
      src/Form/MultipleForm.php
  11. 51 47
      src/Form/NestedForm.php
  12. 27 16
      src/Form/StepBuilder.php
  13. 8 5
      src/Form/StepForm.php
  14. 5 9
      src/Form/Tools.php
  15. 24 11
      src/Grid.php
  16. 6 2
      src/Grid/Actions/Delete.php
  17. 27 14
      src/Grid/Column.php
  18. 4 5
      src/Grid/Column/Condition.php
  19. 0 1
      src/Grid/Column/Filter.php
  20. 3 3
      src/Grid/Column/Filter/Between.php
  21. 2 5
      src/Grid/Column/Filter/Checkbox.php
  22. 3 4
      src/Grid/Column/Filter/Equal.php
  23. 0 1
      src/Grid/Column/Filter/Gt.php
  24. 1 1
      src/Grid/Column/Filter/In.php
  25. 3 2
      src/Grid/Column/Filter/Input.php
  26. 0 1
      src/Grid/Column/Filter/Like.php
  27. 0 1
      src/Grid/Column/Filter/Lt.php
  28. 0 1
      src/Grid/Column/Filter/Ngt.php
  29. 0 1
      src/Grid/Column/Filter/Nlt.php
  30. 0 1
      src/Grid/Column/Filter/StartWith.php
  31. 15 6
      src/Grid/Column/HasDisplayers.php
  32. 4 3
      src/Grid/Column/HasHeader.php
  33. 2 3
      src/Grid/Column/Help.php
  34. 4 4
      src/Grid/Column/Sorter.php
  35. 6 4
      src/Grid/Concerns/HasActions.php
  36. 6 7
      src/Grid/Concerns/HasExporter.php
  37. 4 0
      src/Grid/Concerns/HasFilter.php
  38. 7 3
      src/Grid/Concerns/HasMultipleHeader.php
  39. 1 1
      src/Grid/Concerns/HasPaginator.php
  40. 14 18
      src/Grid/Concerns/HasQuickSearch.php
  41. 14 7
      src/Grid/Concerns/HasTools.php
  42. 4 3
      src/Grid/Displayers/AbstractDisplayer.php
  43. 2 4
      src/Grid/Displayers/Actions.php
  44. 1 2
      src/Grid/Displayers/Checkbox.php
  45. 0 1
      src/Grid/Displayers/Copyable.php
  46. 1 2
      src/Grid/Displayers/Downloadable.php
  47. 3 3
      src/Grid/Displayers/DropdownActions.php
  48. 1 1
      src/Grid/Displayers/Editable.php
  49. 1 1
      src/Grid/Displayers/Expand.php
  50. 0 3
      src/Grid/Displayers/Link.php
  51. 1 2
      src/Grid/Displayers/Orderable.php
  52. 0 1
      src/Grid/Displayers/QRCode.php
  53. 2 3
      src/Grid/Displayers/RowSelector.php
  54. 5 6
      src/Grid/Displayers/SwitchDisplay.php
  55. 3 3
      src/Grid/Displayers/SwitchGroup.php
  56. 15 11
      src/Grid/Displayers/Tree.php
  57. 11 6
      src/Grid/Exporter.php
  58. 11 7
      src/Grid/Exporters/AbstractExporter.php
  59. 2 3
      src/Grid/Exporters/ExcelExporter.php
  60. 13 12
      src/Grid/Filter.php
  61. 6 4
      src/Grid/Filter/AbstractFilter.php
  62. 2 2
      src/Grid/Filter/Between.php
  63. 3 3
      src/Grid/Filter/Group.php
  64. 0 1
      src/Grid/Filter/Layout/Layout.php
  65. 0 2
      src/Grid/Filter/Presenter/Checkbox.php
  66. 1 1
      src/Grid/Filter/Presenter/DateTime.php
  67. 2 1
      src/Grid/Filter/Presenter/Presenter.php
  68. 0 1
      src/Grid/Filter/Presenter/Radio.php
  69. 7 9
      src/Grid/Filter/Presenter/Select.php
  70. 8 7
      src/Grid/Filter/Presenter/SelectResource.php
  71. 0 1
      src/Grid/Filter/StartWith.php
  72. 2 2
      src/Grid/Filter/Where.php
  73. 0 8
      src/Grid/GridAction.php
  74. 10 9
      src/Grid/Header.php
  75. 11 7
      src/Grid/Model.php
  76. 2 3
      src/Grid/Responsive.php
  77. 2 0
      src/Grid/Row.php
  78. 0 1
      src/Grid/Tools/BatchAction.php
  79. 0 1
      src/Grid/Tools/BatchDelete.php
  80. 3 3
      src/Grid/Tools/CreateButton.php
  81. 4 6
      src/Grid/Tools/ExportButton.php
  82. 3 2
      src/Grid/Tools/QuickSearch.php
  83. 13 15
      src/Grid/Tools/Selector.php

+ 1 - 1
resources/views/index.blade.php

@@ -28,7 +28,7 @@
     <![endif]-->
 </head>
 
-<body class="dcat-admin-body hold-transition {{config('admin.skin')}} {{join(' ', config('admin.layout'))}}">
+<body class="dcat-admin-body hold-transition {{config('admin.skin')}} {{implode(' ', config('admin.layout'))}}">
     {!! admin_section(\AdminSection::BODY_INNER_BEFORE) !!}
 
     @include('admin::partials.script')

+ 0 - 1
src/Form.php

@@ -1074,7 +1074,6 @@ class Form implements Renderable
                 $first = explode('.', $column)[0];
                 $relations[$first] = null;
             }
-
         });
 
         foreach ($relations as $first => $v) {

+ 1 - 1
src/Form/Field/SelectResource.php

@@ -13,7 +13,7 @@ class SelectResource extends Field
     use PlainInput;
 
     protected static $js = [
-        'vendor/dcat-admin/dcat-admin/select-resource.min.js'
+        'vendor/dcat-admin/dcat-admin/select-resource.min.js',
     ];
 
     protected $area = ['55%', '68%'];

+ 0 - 1
src/Form/Field/SwitchField.php

@@ -56,7 +56,6 @@ class SwitchField extends Field
     }
 
     /**
-     *
      * @param string $color
      *
      * @return $this

+ 1 - 0
src/Form/Field/Text.php

@@ -78,6 +78,7 @@ class Text extends Field
     /**
      * @param int         $length
      * @param string|null $error
+     *
      * @return $this
      */
     public function minLength(int $length, ?string $error = null)

+ 29 - 20
src/Form/Field/UploadField.php

@@ -4,11 +4,11 @@ namespace Dcat\Admin\Form\Field;
 
 use Illuminate\Support\Arr;
 use Illuminate\Support\Facades\Storage;
+use Illuminate\Support\Facades\URL;
 use Illuminate\Support\Facades\Validator;
 use Symfony\Component\Finder\Finder;
 use Symfony\Component\HttpFoundation\File\UploadedFile;
 use Symfony\Component\HttpFoundation\Response;
-use Illuminate\Support\Facades\URL;
 
 trait UploadField
 {
@@ -75,7 +75,7 @@ trait UploadField
     {
         $this->disk(config('admin.upload.disk'));
 
-        if (! $this->storage) {
+        if (!$this->storage) {
             $this->storage = false;
         }
     }
@@ -160,6 +160,7 @@ trait UploadField
      * Upload File.
      *
      * @param UploadedFile $file
+     *
      * @return Response
      */
     public function upload(UploadedFile $file)
@@ -170,7 +171,7 @@ trait UploadField
                 return $this->responseError(403, 'Missing id');
             }
 
-            if (! ($file = $this->mergeChunks($id, $file))) {
+            if (!($file = $this->mergeChunks($id, $file))) {
                 return $this->response(['merge' => 1]);
             }
 
@@ -202,7 +203,7 @@ trait UploadField
                     'id'     => $path,
                     'name'   => $this->name,
                     'path'   => basename($path),
-                    'url'    => $this->objectUrl($path)
+                    'url'    => $this->objectUrl($path),
                 ]);
             }
 
@@ -223,8 +224,9 @@ trait UploadField
     }
 
     /**
-     * @param string $id
+     * @param string       $id
      * @param UploadedFile $file
+     *
      * @return UploadedFile|null
      */
     protected function mergeChunks($id, UploadedFile $file)
@@ -249,7 +251,9 @@ trait UploadField
             }
         }
 
-        if (!$done) return;
+        if (!$done) {
+            return;
+        }
 
         $this->tempFilePath = $tmpDir.'/'.$newFilename.'.tmp';
         $this->putTempFileContent($chunks, $tmpDir, $newFilename);
@@ -284,7 +288,7 @@ trait UploadField
     }
 
     /**
-     * @param int $chunks
+     * @param int    $chunks
      * @param string $tmpDir
      * @param string $newFilename
      */
@@ -309,16 +313,18 @@ trait UploadField
 
             flock($out, LOCK_UN);
         }
+
         fclose($out);
     }
 
     /**
-     * @param $id
+     * @param mixed $id
+     *
      * @return string
      */
     protected function getTempDir($id)
     {
-        $tmpDir = storage_path('tmp/' . $id);
+        $tmpDir = storage_path('tmp/'.$id);
 
         if (!is_dir($tmpDir)) {
             app('files')->makeDirectory($tmpDir, 0755, true);
@@ -332,18 +338,20 @@ trait UploadField
      *
      * @param $code
      * @param $error
+     *
      * @return \Illuminate\Http\JsonResponse
      */
     protected function responseError($code, $error)
     {
         return $this->response([
-            'error' => ['code' => $code, 'message' => $error], 'status' => false
+            'error' => ['code' => $code, 'message' => $error], 'status' => false,
         ]);
     }
 
     /**
      *
      * @param array $message
+     *
      * @return \Illuminate\Http\JsonResponse
      */
     protected function response(array $message)
@@ -354,7 +362,7 @@ trait UploadField
     /**
      * Specify the directory and name for upload file.
      *
-     * @param string $directory
+     * @param string      $directory
      * @param null|string $name
      *
      * @return $this
@@ -433,7 +441,7 @@ trait UploadField
      */
     protected function generateUniqueName(UploadedFile $file)
     {
-        return md5(uniqid()) . '.' . $file->getClientOriginalExtension();
+        return md5(uniqid()).'.'.$file->getClientOriginalExtension();
     }
 
     /**
@@ -448,11 +456,11 @@ trait UploadField
         $index = 1;
         $extension = $file->getClientOriginalExtension();
         $originalName = $file->getClientOriginalName();
-        $newName = $originalName . '_' . $index . '.' . $extension;
+        $newName = $originalName.'_'.$index.'.'.$extension;
 
         while ($this->getStorage()->exists("{$this->getDirectory()}/$newName")) {
             $index++;
-            $newName = $originalName . '_' . $index . '.' . $extension;
+            $newName = $originalName.'_'.$index.'.'.$extension;
         }
 
         return $newName;
@@ -505,15 +513,14 @@ trait UploadField
      */
     public function destroyIfChanged($file)
     {
-        if (! $file || ! $this->original) {
+        if (!$file || !$this->original) {
             return $this->destroy();
         }
 
-        $file = array_filter((array)$file);
-        $original = (array)$this->original;
+        $file = array_filter((array) $file);
+        $original = (array) $this->original;
 
         $this->deleteFile(Arr::except(array_combine($original, $original), $file));
-
     }
 
     /**
@@ -526,6 +533,7 @@ trait UploadField
         if (!$path) {
             return;
         }
+
         if (is_array($path)) {
             foreach ($path as $v) {
                 $this->deleteFile($v);
@@ -567,9 +575,9 @@ trait UploadField
      *
      * @param string $disk Disks defined in `config/filesystems.php`.
      *
-     * @return $this
      * @throws \Exception
      *
+     * @return $this
      */
     public function disk($disk)
     {
@@ -594,7 +602,7 @@ trait UploadField
     /**
      * Get file visit url.
      *
-     * @param $path
+     * @param string $path
      *
      * @return string
      */
@@ -609,6 +617,7 @@ trait UploadField
 
     /**
      * @param $permission
+     *
      * @return $this
      */
     public function storagePermission($permission)

+ 9 - 4
src/Form/Field/WebUploader.php

@@ -17,8 +17,9 @@ trait WebUploader
     protected $options = [];
 
     /**
-     * @param string $extensions exp. gif,jpg,jpeg,bmp,png
+     * @param string      $extensions exp. gif,jpg,jpeg,bmp,png
      * @param string|null $mimeTypes exp. image/*
+     *
      * @return $this
      */
     public function accept(string $extensions, string $mimeTypes = null)
@@ -36,6 +37,7 @@ trait WebUploader
 
     /**
      * @param bool $disable
+     *
      * @return $this
      */
     public function disableChunked(bool $disable = true)
@@ -47,6 +49,7 @@ trait WebUploader
 
     /**
      * @param int|null $size kb
+     *
      * @return $this
      */
     public function chunkSize(int $size)
@@ -58,6 +61,7 @@ trait WebUploader
 
     /**
      * @param int $size kb
+     *
      * @return $this
      */
     public function maxSize(int $size)
@@ -70,6 +74,7 @@ trait WebUploader
 
     /**
      * @param int $num
+     *
      * @return $this
      */
     public function threads(int $num)
@@ -83,6 +88,7 @@ trait WebUploader
      * Set upload server.
      *
      * @param string $server
+     *
      * @return $this
      */
     public function url(string $server)
@@ -104,7 +110,6 @@ trait WebUploader
         return $this;
     }
 
-
     /**
      * Disable remove file.
      *
@@ -121,6 +126,7 @@ trait WebUploader
      * Set upload server.
      *
      * @param string $server
+     *
      * @return $this
      */
     public function deleteUrl(string $server)
@@ -170,7 +176,7 @@ trait WebUploader
 
     protected function setDefaultServer()
     {
-        if (! $this->form || ! method_exists($this->form, 'getAction')) {
+        if (!$this->form || !method_exists($this->form, 'getAction')) {
             return;
         }
 
@@ -223,5 +229,4 @@ trait WebUploader
 
         return $this;
     }
-
 }

+ 2 - 3
src/Form/Footer.php

@@ -2,7 +2,6 @@
 
 namespace Dcat\Admin\Form;
 
-use Dcat\Admin\Admin;
 use Dcat\Admin\Widgets\Checkbox;
 use Illuminate\Contracts\Support\Renderable;
 
@@ -148,11 +147,11 @@ class Footer implements Renderable
         }
 
         if (in_array('view', $this->checkboxes)) {
-            $options[3] =  sprintf('<span class="text-80 text-bold">%s</span>', trans('admin.view'));;
+            $options[3] =  sprintf('<span class="text-80 text-bold">%s</span>', trans('admin.view'));
         }
 
         if (!$options) {
-            return null;
+            return;
         }
 
         return (new Checkbox('after-save', $options))->inline()->circle(true);

+ 6 - 6
src/Form/Layout.php

@@ -2,8 +2,8 @@
 
 namespace Dcat\Admin\Form;
 
-use Dcat\Admin\Layout\Column;
 use Dcat\Admin\Form;
+use Dcat\Admin\Layout\Column;
 
 class Layout
 {
@@ -23,8 +23,8 @@ class Layout
     }
 
     /**
-     * @param int $width 1~12
-     * @param $content
+     * @param int   $width 1~12
+     * @param mixed $content
      */
     public function column(int $width, $content)
     {
@@ -36,9 +36,8 @@ class Layout
     }
 
     /**
-     *
-     * @param int $width
-     * @param $content
+     * @param int   $width
+     * @param mixed $content
      */
     public function prepend(int $width, $content)
     {
@@ -51,6 +50,7 @@ class Layout
 
     /**
      * @param \Closure|null $callback
+     *
      * @return MultipleForm
      */
     public function form(\Closure $callback = null)

+ 2 - 1
src/Form/MultipleForm.php

@@ -19,7 +19,7 @@ class MultipleForm extends WidgetForm
 
     public function __construct(Form $form)
     {
-        $this->form    = $form;
+        $this->form = $form;
         $this->builder = $form->builder();
 
         $this->initFields();
@@ -31,6 +31,7 @@ class MultipleForm extends WidgetForm
      * Add a form field to form.
      *
      * @param Field $field
+     *
      * @return $this
      */
     public function pushField(Field &$field)

+ 51 - 47
src/Form/NestedForm.php

@@ -11,52 +11,56 @@ use Illuminate\Support\Collection;
 /**
  * Class Form.
  *
- * @method Field\Text           text($column, $label = '')
- * @method Field\Checkbox       checkbox($column, $label = '')
- * @method Field\Radio          radio($column, $label = '')
- * @method Field\Select         select($column, $label = '')
- * @method Field\MultipleSelect multipleSelect($column, $label = '')
- * @method Field\Textarea       textarea($column, $label = '')
- * @method Field\Hidden         hidden($column, $label = '')
- * @method Field\Id             id($column, $label = '')
- * @method Field\Ip             ip($column, $label = '')
- * @method Field\Url            url($column, $label = '')
- * @method Field\Color          color($column, $label = '')
- * @method Field\Email          email($column, $label = '')
- * @method Field\Mobile         mobile($column, $label = '')
- * @method Field\Slider         slider($column, $label = '')
- * @method Field\Map            map($latitude, $longitude, $label = '')
- * @method Field\Editor         editor($column, $label = '')
- * @method Field\Date           date($column, $label = '')
- * @method Field\Datetime       datetime($column, $label = '')
- * @method Field\Time           time($column, $label = '')
- * @method Field\Year           year($column, $label = '')
- * @method Field\Month          month($column, $label = '')
- * @method Field\DateRange      dateRange($start, $end, $label = '')
- * @method Field\DateTimeRange  datetimeRange($start, $end, $label = '')
- * @method Field\TimeRange      timeRange($start, $end, $label = '')
- * @method Field\Number         number($column, $label = '')
- * @method Field\Currency       currency($column, $label = '')
- * @method Field\HasMany        hasMany($relationName, $callback)
- * @method Field\SwitchField    switch($column, $label = '')
- * @method Field\Display        display($column, $label = '')
- * @method Field\Rate           rate($column, $label = '')
- * @method Field\Divide         divider()
- * @method Field\Password       password($column, $label = '')
- * @method Field\Decimal        decimal($column, $label = '')
- * @method Field\Html           html($html, $label = '')
- * @method Field\Tags           tags($column, $label = '')
- * @method Field\Icon           icon($column, $label = '')
- * @method Field\Embeds         embeds($column, $label = '')
- * @method Field\Captcha        captcha($column, $label = '')
- * @method Field\Listbox        listbox($column, $label = '')
- * @method Field\SelectResource selectResource($column, $label = '')
- * @method Field\File           file($column, $label = '')
- * @method Field\Image          image($column, $label = '')
- * @method Field\MultipleFile   multipleFile($column, $label = '')
- * @method Field\MultipleImage  multipleImage($column, $label = '')
- * @method Field\Tree           tree($column, $label = '')
- *
+ * @method Field\Text                   text($column, $label = '')
+ * @method Field\Checkbox               checkbox($column, $label = '')
+ * @method Field\Radio                  radio($column, $label = '')
+ * @method Field\Select                 select($column, $label = '')
+ * @method Field\MultipleSelect         multipleSelect($column, $label = '')
+ * @method Field\Textarea               textarea($column, $label = '')
+ * @method Field\Hidden                 hidden($column, $label = '')
+ * @method Field\Id                     id($column, $label = '')
+ * @method Field\Ip                     ip($column, $label = '')
+ * @method Field\Url                    url($column, $label = '')
+ * @method Field\Color                  color($column, $label = '')
+ * @method Field\Email                  email($column, $label = '')
+ * @method Field\Mobile                 mobile($column, $label = '')
+ * @method Field\Slider                 slider($column, $label = '')
+ * @method Field\Map                    map($latitude, $longitude, $label = '')
+ * @method Field\Editor                 editor($column, $label = '')
+ * @method Field\Date                   date($column, $label = '')
+ * @method Field\Datetime               datetime($column, $label = '')
+ * @method Field\Time                   time($column, $label = '')
+ * @method Field\Year                   year($column, $label = '')
+ * @method Field\Month                  month($column, $label = '')
+ * @method Field\DateRange              dateRange($start, $end, $label = '')
+ * @method Field\DateTimeRange          datetimeRange($start, $end, $label = '')
+ * @method Field\TimeRange              timeRange($start, $end, $label = '')
+ * @method Field\Number                 number($column, $label = '')
+ * @method Field\Currency               currency($column, $label = '')
+ * @method Field\SwitchField            switch($column, $label = '')
+ * @method Field\Display                display($column, $label = '')
+ * @method Field\Rate                   rate($column, $label = '')
+ * @method Field\Divide                 divider()
+ * @method Field\Password               password($column, $label = '')
+ * @method Field\Decimal                decimal($column, $label = '')
+ * @method Field\Html                   html($html, $label = '')
+ * @method Field\Tags                   tags($column, $label = '')
+ * @method Field\Icon                   icon($column, $label = '')
+ * @method Field\Embeds                 embeds($column, $label = '')
+ * @method Field\Captcha                captcha()
+ * @method Field\Listbox                listbox($column, $label = '')
+ * @method Field\SelectResource         selectResource($column, $label = '')
+ * @method Field\File                   file($column, $label = '')
+ * @method Field\Image                  image($column, $label = '')
+ * @method Field\MultipleFile           multipleFile($column, $label = '')
+ * @method Field\MultipleImage          multipleImage($column, $label = '')
+ * @method Field\HasMany                hasMany($column, $labelOrCallback, $callback = null)
+ * @method Field\Tree                   tree($column, $label = '')
+ * @method Field\Table                  table($column, $labelOrCallback, $callback = null)
+ * @method Field\ListField              list($column, $label = '')
+ * @method Field\Timezone               timezone($column, $label = '')
+ * @method Field\KeyValue               keyValue($column, $label = '')
+ * @method Field\Tel                    tel($column, $label = '')
  * @method Field\BootstrapFile          bootstrapFile($column, $label = '')
  * @method Field\BootstrapImage         bootstrapImage($column, $label = '')
  * @method Field\BootstrapMultipleImage bootstrapMultipleImage($column, $label = '')
@@ -157,7 +161,7 @@ class NestedForm
         }
 
         foreach ($data as $value) {
-            if (! isset($value[$relatedKeyName])) {
+            if (!isset($value[$relatedKeyName])) {
                 continue;
             }
 

+ 27 - 16
src/Form/StepBuilder.php

@@ -49,8 +49,9 @@ class StepBuilder
     }
 
     /**
-     * @param string $title
+     * @param string   $title
      * @param \Closure $callback
+     *
      * @return $this
      */
     public function add(string $title, \Closure $callback)
@@ -88,7 +89,8 @@ class StepBuilder
      * Set options.
      *
      * @param string|array $key
-     * @param mixed $value
+     * @param mixed        $value
+     *
      * @return $this
      */
     public function option($key, $value = null)
@@ -106,7 +108,8 @@ class StepBuilder
      * Get options.
      *
      * @param string|null $key
-     * @param null $default
+     * @param null        $default
+     *
      * @return array|mixed|null
      */
     public function getOption($key = null, $default = null)
@@ -119,9 +122,8 @@ class StepBuilder
     }
 
     /**
-     * Select
-     *
      * @param int $index
+     *
      * @return $this
      */
     public function select(int $index)
@@ -133,6 +135,7 @@ class StepBuilder
      * Set padding for container.
      *
      * @param string $padding
+     *
      * @return $this
      */
     public function padding(string $padding)
@@ -144,6 +147,7 @@ class StepBuilder
      * Set max width for container.
      *
      * @param string $width
+     *
      * @return $this
      */
     public function width(string $width)
@@ -155,6 +159,7 @@ class StepBuilder
      * Remember input data.
      *
      * @param bool $value
+     *
      * @return $this
      */
     public function remember(bool $value = true)
@@ -164,7 +169,8 @@ class StepBuilder
 
     /**
      * @param string|Closure $title
-     * @param Closure|null $callback
+     * @param Closure|null   $callback
+     *
      * @return $this
      */
     public function done($title, Closure $callback = null)
@@ -214,12 +220,13 @@ class StepBuilder
      * Stash input data.
      *
      * @param array $data
-     * @param bool $merge
+     * @param bool  $merge
+     *
      * @return void
      */
     public function stash(array $data, bool $merge = false)
     {
-        if (! $this->options['remember']) {
+        if (!$this->options['remember']) {
             return;
         }
 
@@ -237,7 +244,7 @@ class StepBuilder
      */
     public function fetchStash()
     {
-        if (! $this->options['remember']) {
+        if (!$this->options['remember']) {
             return [];
         }
 
@@ -251,7 +258,7 @@ class StepBuilder
      */
     public function flushStash()
     {
-        if (! $this->options['remember']) {
+        if (!$this->options['remember']) {
             return;
         }
 
@@ -262,6 +269,7 @@ class StepBuilder
      * Forget input data by keys.
      *
      * @param string|array $keys
+     *
      * @return void
      */
     public function forgetStash($keys)
@@ -275,6 +283,7 @@ class StepBuilder
 
     /**
      * @param string|Field $field
+     *
      * @return void
      */
     public function stashIndexByField($field)
@@ -314,20 +323,20 @@ class StepBuilder
      */
     protected function selectStep()
     {
-        if (! $this->options['remember'] || ! $input = $this->fetchStash()) {
+        if (!$this->options['remember'] || !$input = $this->fetchStash()) {
             return;
         }
 
         $current = $input[static::CURRENT_VALIDATION_STEP] ?? null;
         $allStep = $input[static::ALL_STEPS] ?? null;
 
-        unset($input[static::CURRENT_VALIDATION_STEP],  $input[static::ALL_STEPS]);
+        unset($input[static::CURRENT_VALIDATION_STEP], $input[static::ALL_STEPS]);
 
-        if ($current !== null && $current !== '' && ! empty($input)) {
+        if ($current !== null && $current !== '' && !empty($input)) {
             $this->select((int) ($current + 1));
         }
 
-        if (! empty($allStep) && ! empty($input)) {
+        if (!empty($allStep) && !empty($input)) {
             $this->select($this->count() - 1);
         }
     }
@@ -367,7 +376,7 @@ class StepBuilder
     {
         $html = '';
 
-        foreach($this->stepForms as $step) {
+        foreach ($this->stepForms as $step) {
             $html .= (string) $step->render();
         }
 
@@ -378,6 +387,7 @@ class StepBuilder
      * Register the "showStep" event listener.
      *
      * @param string $script
+     *
      * @return $this
      */
     public function shown($script)
@@ -397,6 +407,7 @@ JS;
      * Register the "leaveStep" event listener.
      *
      * @param string $script
+     *
      * @return $this
      */
     public function leaving($script)
@@ -414,6 +425,7 @@ JS;
 
     /**
      * @param string|Field $column
+     *
      * @return false|int
      */
     public function getFieldIndex($column)
@@ -426,5 +438,4 @@ JS;
 
         return false;
     }
-
 }

+ 8 - 5
src/Form/StepForm.php

@@ -45,15 +45,15 @@ class StepForm extends WidgetForm
     /**
      * StepForm constructor.
      *
-     * @param Form $form
-     * @param int $index
+     * @param Form   $form
+     * @param int    $index
      * @param string $title
      */
     public function __construct(Form $form, int $index = 0, string $title = null)
     {
-        $this->form   = $form;
+        $this->form = $form;
         $this->parent = $form->builder()->getStepBuilder();
-        $this->index  = $index;
+        $this->index = $index;
 
         $this->initFields();
 
@@ -62,6 +62,7 @@ class StepForm extends WidgetForm
 
     /**
      * @param string|\Closure $title
+     *
      * @return $this
      */
     public function title($title)
@@ -73,6 +74,7 @@ class StepForm extends WidgetForm
 
     /**
      * @param string|\Closure $content
+     *
      * @return $this
      */
     public function description($content)
@@ -157,6 +159,7 @@ HTML;
 
     /**
      * @param string $script
+     *
      * @return $this
      */
     public function leaving($script)
@@ -176,6 +179,7 @@ JS
 
     /**
      * @param string $script
+     *
      * @return $this
      */
     public function shown($script)
@@ -192,5 +196,4 @@ JS
 
         return $this;
     }
-
 }

+ 5 - 9
src/Form/Tools.php

@@ -2,9 +2,7 @@
 
 namespace Dcat\Admin\Form;
 
-use Dcat\Admin\Admin;
 use Dcat\Admin\Support\Helper;
-use Illuminate\Contracts\Support\Htmlable;
 use Illuminate\Contracts\Support\Renderable;
 use Illuminate\Support\Collection;
 
@@ -58,8 +56,8 @@ class Tools implements Renderable
      */
     public function __construct(Builder $builder)
     {
-        $this->form     = $builder;
-        $this->appends  = new Collection();
+        $this->form = $builder;
+        $this->appends = new Collection();
         $this->prepends = new Collection();
     }
 
@@ -154,13 +152,11 @@ class Tools implements Renderable
      */
     protected function getViewPath()
     {
-        $key = $this->form->getResourceId();
-
-        if ($key) {
+        if ($key = $this->form->getResourceId()) {
             return $this->getListPath().'/'.$key;
-        } else {
-            return $this->getListPath();
         }
+
+        return $this->getListPath();
     }
 
     /**

+ 24 - 11
src/Grid.php

@@ -3,21 +3,21 @@
 namespace Dcat\Admin;
 
 use Closure;
+use Dcat\Admin\Contracts\Repository;
 use Dcat\Admin\Grid\Column;
+use Dcat\Admin\Grid\Concerns;
 use Dcat\Admin\Grid\Displayers;
 use Dcat\Admin\Grid\Model;
 use Dcat\Admin\Grid\Responsive;
 use Dcat\Admin\Grid\Row;
 use Dcat\Admin\Grid\Tools;
-use Dcat\Admin\Grid\Concerns;
-use Dcat\Admin\Contracts\Repository;
 use Dcat\Admin\Support\Helper;
 use Dcat\Admin\Traits\HasBuilderEvents;
-use Illuminate\Support\Traits\Macroable;
 use Illuminate\Contracts\Support\Htmlable;
 use Illuminate\Contracts\Support\Renderable;
 use Illuminate\Support\Collection;
 use Illuminate\Support\Str;
+use Illuminate\Support\Traits\Macroable;
 
 class Grid
 {
@@ -176,19 +176,21 @@ class Grid
      * Create a new grid instance.
      *
      * Grid constructor.
+     *
      * @param Repository|null $repository
-     * @param null $builder
+     * @param null|\Closure   $builder
      */
     public function __construct(?Repository $repository = null, ?\Closure $builder = null)
     {
         if ($repository) {
             $this->keyName = $repository->getKeyName();
         }
-        $this->model    = new Model(request(), $repository);
-        $this->columns  = new Collection();
-        $this->rows     = new Collection();
-        $this->builder  = $builder;
-        $this->tableId  = 'grid-'.Str::random(8);
+
+        $this->model = new Model(request(), $repository);
+        $this->columns = new Collection();
+        $this->rows = new Collection();
+        $this->builder = $builder;
+        $this->tableId = 'grid-'.Str::random(8);
 
         $this->model()->setGrid($this);
 
@@ -208,7 +210,6 @@ class Grid
         return $this->tableId;
     }
 
-
     /**
      * Get primary key name of model.
      *
@@ -256,6 +257,7 @@ class Grid
      * Add number column.
      *
      * @param null|string $label
+     *
      * @return Column
      */
     public function number(?string $label = null)
@@ -339,6 +341,7 @@ class Grid
 
     /**
      * @param array $options
+     *
      * @return $this
      */
     public function setRowSelectorOptions(array $options = [])
@@ -493,6 +496,7 @@ HTML
     /**
      * @param string $width
      * @param string $height
+     *
      * @return $this
      */
     public function setModalFormDimensions(string $width, string $height)
@@ -538,7 +542,9 @@ HTML
         if (!$content) {
             return $this->header;
         }
+
         $this->header = $content;
+
         return $this;
     }
 
@@ -683,6 +689,7 @@ HTML;
 
     /**
      * @param bool $disable
+     *
      * @return $this
      */
     public function disableQuickCreateButton(bool $disable = true)
@@ -692,6 +699,7 @@ HTML;
 
     /**
      * @param bool $val
+     *
      * @return $this
      */
     public function showQuickCreateButton(bool $val = true)
@@ -723,6 +731,7 @@ HTML;
      * Set resource path.
      *
      * @param string $path
+     *
      * @return $this
      */
     public function resource(string $path)
@@ -730,6 +739,7 @@ HTML;
         if (!empty($path)) {
             $this->resourcePath = admin_url($path);
         }
+
         return $this;
     }
 
@@ -749,6 +759,7 @@ HTML;
      * Create a grid instance.
      *
      * @param mixed ...$params
+     *
      * @return $this
      */
     public static function make(...$params)
@@ -758,6 +769,7 @@ HTML;
 
     /**
      * Enable responsive tables.
+     *
      * @see https://github.com/nadangergeo/RWD-Table-Patterns
      *
      * @return Responsive
@@ -781,6 +793,7 @@ HTML;
 
     /**
      * @param Closure $closure
+     *
      * @return $this;
      */
     public function wrap(\Closure $closure)
@@ -920,6 +933,7 @@ HTML;
      * Add column to grid.
      *
      * @param string $name
+     *
      * @return Column
      */
     public function __get($name)
@@ -943,5 +957,4 @@ HTML;
 
         return $this->addColumn($method, $arguments[0] ?? null);
     }
-
 }

+ 6 - 2
src/Grid/Actions/Delete.php

@@ -17,11 +17,15 @@ class Delete extends RowAction
     public function render()
     {
         $this->setHtmlAttribute([
-            'data-url' => "{$this->getResource()}/{$this->getKey()}",
+            'data-url'    => $this->getUrl(),
             'data-action' => 'delete',
-
         ]);
 
         return parent::render(); // TODO: Change the autogenerated stub
     }
+
+    public function getUrl()
+    {
+        return "{$this->getResource()}/{$this->getKey()}";
+    }
 }

+ 27 - 14
src/Grid/Column.php

@@ -35,7 +35,6 @@ use Illuminate\Support\Str;
  * @method $this downloadable($server = '', $disk = null)
  * @method $this copyable()
  * @method $this orderable()
- *
  * @method $this ascii()
  * @method $this camel()
  * @method $this finish($cap)
@@ -239,16 +238,17 @@ class Column
      * Set width for column.
      *
      * @param string $width
+     *
      * @return $this|string
      */
     public function width(?string $width)
     {
         $this->titleHtmlAttributes['width'] = $width;
+
         return $this;
     }
 
     /**
-     *
      * @example
      *     $grid->config
      *         ->if(function () {
@@ -271,6 +271,7 @@ class Column
      *         })
      *
      * @param \Closure $condition
+     *
      * @return Column\Condition
      */
     public function if(\Closure $condition)
@@ -305,7 +306,6 @@ class Column
     }
 
     /**
-     *
      * @return $this
      */
     public function hide()
@@ -314,8 +314,6 @@ class Column
     }
 
     /**
-     * responsive
-     *
      * data-priority=”1″ 保持可见,但可以在下拉列表筛选隐藏。
      * data-priority=”2″ 480px 分辨率以下可见
      * data-priority=”3″ 640px 以下可见
@@ -324,6 +322,7 @@ class Column
      * data-priority=”6″ 1120px 以下可见
      *
      * @param int $priority
+     *
      * @return $this
      */
     public function responsive(?int $priority = 1)
@@ -402,13 +401,15 @@ class Column
     /**
      * Format label.
      *
-     * @param $label
+     * @param string $label
      *
      * @return mixed
      */
     protected function formatLabel($label)
     {
-        if (!$label) $label = admin_trans_field($this->name);
+        if (!$label) {
+            $label = admin_trans_field($this->name);
+        }
 
         $label = $label ?: ucfirst($this->name);
 
@@ -425,6 +426,11 @@ class Column
         return $this->label;
     }
 
+    /**
+     * @param string $label
+     *
+     * @return $this
+     */
     public function setLabel($label)
     {
         $this->label = $label;
@@ -436,7 +442,8 @@ class Column
      * Mark this column as sortable.
      *
      * @param string $cast
-     * @return Column|string
+     *
+     * @return $this
      */
     public function sortable($cast = null)
     {
@@ -447,8 +454,8 @@ class Column
      * Set help message for column.
      *
      * @param string|\Closure $help
-     * @param null|string $style 'green', 'blue', 'red', 'purple'
-     * @param null|string $placement 'bottom', 'left', 'right', 'top'
+     * @param null|string     $style 'green', 'blue', 'red', 'purple'
+     * @param null|string     $placement 'bottom', 'left', 'right', 'top'
      *
      * @return $this
      */
@@ -481,8 +488,9 @@ class Column
     /**
      * Add a display callback.
      *
-     * @param $callback
-     * @param array $params
+     * @param \Closure $callback
+     * @param array    $params
+     *
      * @return $this
      */
     public function display($callback, ...$params)
@@ -499,7 +507,7 @@ class Column
      */
     public function hasDisplayCallbacks()
     {
-        return ! empty($this->displayCallbacks);
+        return !empty($this->displayCallbacks);
     }
 
     /**
@@ -581,7 +589,7 @@ class Column
         $i = 0;
         foreach ($data as $key => &$row) {
             $i++;
-            if (! isset($row['#'])) {
+            if (!isset($row['#'])) {
                 $row['#'] = $i;
             }
 
@@ -629,6 +637,7 @@ class Column
 
         if ($class instanceof Closure) {
             $this->display($class);
+
             return;
         }
 
@@ -750,11 +759,13 @@ class Column
      * Set column title attributes.
      *
      * @param array $attributes
+     *
      * @return $this
      */
     public function setHeaderAttributes(array $attributes = [])
     {
         $this->titleHtmlAttributes = array_merge($this->titleHtmlAttributes, $attributes);
+
         return $this;
     }
 
@@ -762,6 +773,7 @@ class Column
      * Set column title default attributes.
      *
      * @param array $attributes
+     *
      * @return $this
      */
     public function setDefaultHeaderAttribute(array $attributes)
@@ -770,6 +782,7 @@ class Column
             if (isset($this->titleHtmlAttributes[$key])) {
                 continue;
             }
+
             $this->titleHtmlAttributes[$key] = $value;
         }
 

+ 4 - 5
src/Grid/Column/Condition.php

@@ -37,8 +37,8 @@ class Condition
     public function __construct($condition, Column $column)
     {
         $this->condition = $condition;
-        $this->original  = clone $column;
-        $this->column    = $column;
+        $this->original = clone $column;
+        $this->column = $column;
     }
 
     public function then(\Closure $closure)
@@ -53,7 +53,7 @@ class Condition
         $self = $this;
 
         $condition = $this->column->if(function () use ($self) {
-            return ! $self->getResult();
+            return !$self->getResult();
         });
 
         if ($next) {
@@ -72,7 +72,7 @@ class Condition
 
     protected function callCallbacks(array $callbacks)
     {
-        if (! $callbacks) {
+        if (!$callbacks) {
             return;
         }
 
@@ -133,5 +133,4 @@ class Condition
             return $column->$name(...$arguments);
         });
     }
-
 }

+ 0 - 1
src/Grid/Column/Filter.php

@@ -132,5 +132,4 @@ abstract class Filter implements Renderable
     {
         return new static(...$params);
     }
-
 }

+ 3 - 3
src/Grid/Column/Filter/Between.php

@@ -3,8 +3,8 @@
 namespace Dcat\Admin\Grid\Column\Filter;
 
 use Dcat\Admin\Admin;
-use Dcat\Admin\Grid\Model;
 use Dcat\Admin\Grid\Column\Filter;
+use Dcat\Admin\Grid\Model;
 
 class Between extends Filter
 {
@@ -66,7 +66,8 @@ class Between extends Filter
     }
 
     /**
-     * @param $format
+     * @param string $format
+     *
      * @return $this
      */
     protected function setDateFormat($format)
@@ -188,5 +189,4 @@ EOT;
         Admin::collectComponentAssets('moment');
         Admin::collectComponentAssets('bootstrap-datetimepicker');
     }
-
 }

+ 2 - 5
src/Grid/Column/Filter/Checkbox.php

@@ -23,7 +23,6 @@ $('.{$this->class['all']}').on('change', function () {
     }
     return false;
 });
-
 JS;
 
         Admin::script($script);
@@ -40,7 +39,7 @@ JS;
 
         $allId = 'filter-all-'.Str::random(5);
 
-        return <<<EOT
+        return <<<HTML
 &nbsp;<span class="dropdown" style="position:absolute;">
 <form action="{$this->getFormAction()}" pjax-container style="display: inline-block;">
     <a href="javascript:void(0);" class="dropdown-toggle {$active}" data-toggle="dropdown">
@@ -68,7 +67,7 @@ JS;
     </ul>
 </form>
 </span>
-EOT;
+HTML;
     }
 
     protected function renderOptions($value)
@@ -87,7 +86,5 @@ EOT;
 </li>
 HTML;
         })->implode("\r\n");
-
     }
-
 }

+ 3 - 4
src/Grid/Column/Filter/Equal.php

@@ -3,8 +3,8 @@
 namespace Dcat\Admin\Grid\Column\Filter;
 
 use Dcat\Admin\Admin;
-use Dcat\Admin\Grid\Model;
 use Dcat\Admin\Grid\Column\Filter;
+use Dcat\Admin\Grid\Model;
 
 class Equal extends Filter
 {
@@ -58,7 +58,8 @@ class Equal extends Filter
     }
 
     /**
-     * @param $format
+     * @param string $format
+     *
      * @return $this
      */
     protected function setDateFormat($format)
@@ -115,6 +116,4 @@ class Equal extends Filter
         Admin::collectComponentAssets('moment');
         Admin::collectComponentAssets('bootstrap-datetimepicker');
     }
-
-
 }

+ 0 - 1
src/Grid/Column/Filter/Gt.php

@@ -21,5 +21,4 @@ class Gt extends Equal
 
         $model->where($this->getColumnName(), '>', $value);
     }
-
 }

+ 1 - 1
src/Grid/Column/Filter/In.php

@@ -2,8 +2,8 @@
 
 namespace Dcat\Admin\Grid\Column\Filter;
 
-use Dcat\Admin\Grid\Model;
 use Dcat\Admin\Grid\Column\Filter;
+use Dcat\Admin\Grid\Model;
 
 class In extends Filter
 {

+ 3 - 2
src/Grid/Column/Filter/Input.php

@@ -27,6 +27,7 @@ JS;
      * Set input placeholder.
      *
      * @param null|string $placeholder
+     *
      * @return $this
      */
     public function placeholder(?string $placeholder)
@@ -44,7 +45,7 @@ JS;
 
         $active = empty($value) ? '' : 'active';
 
-        return <<<EOT
+        return <<<HTML
 &nbsp;<span class="dropdown" style="position: absolute">
     <form action="{$this->getFormAction()}" pjax-container style="display: inline-block;">
     <a href="javascript:void(0);" class="dropdown-toggle {$active}" data-toggle="dropdown">
@@ -62,6 +63,6 @@ JS;
     </ul>
     </form>
 </span>
-EOT;
+HTML;
     }
 }

+ 0 - 1
src/Grid/Column/Filter/Like.php

@@ -21,5 +21,4 @@ class Like extends Equal
 
         $model->where($this->getColumnName(), 'like', "%{$value}%");
     }
-
 }

+ 0 - 1
src/Grid/Column/Filter/Lt.php

@@ -21,5 +21,4 @@ class Lt extends Equal
 
         $model->where($this->getColumnName(), '<', $value);
     }
-
 }

+ 0 - 1
src/Grid/Column/Filter/Ngt.php

@@ -21,5 +21,4 @@ class Ngt extends Equal
 
         $model->where($this->getColumnName(), '<=', $value);
     }
-
 }

+ 0 - 1
src/Grid/Column/Filter/Nlt.php

@@ -21,5 +21,4 @@ class Nlt extends Equal
 
         $model->where($this->getColumnName(), '>=', $value);
     }
-
 }

+ 0 - 1
src/Grid/Column/Filter/StartWith.php

@@ -21,5 +21,4 @@ class StartWith extends Equal
 
         $model->where($this->getColumnName(), 'like', "{$value}%");
     }
-
 }

+ 15 - 6
src/Grid/Column/HasDisplayers.php

@@ -53,6 +53,7 @@ trait HasDisplayers
 
     /**
      * @param string $color
+     *
      * @return $this
      */
     public function bold($color = 'text-80')
@@ -70,6 +71,7 @@ trait HasDisplayers
      * Display column with "long2ip".
      *
      * @param null $default
+     *
      * @return $this
      */
     public function long2ip($default = null)
@@ -103,6 +105,7 @@ trait HasDisplayers
 
     /**
      * @param string $val
+     *
      * @return $this
      */
     public function prepend($val)
@@ -115,12 +118,14 @@ trait HasDisplayers
             } elseif ($v instanceof Collection) {
                 return $v->prepend($val);
             }
-            return $val . $v;
+
+            return $val.$v;
         });
     }
 
     /**
      * @param string $val
+     *
      * @return $this
      */
     public function append($val)
@@ -133,7 +138,8 @@ trait HasDisplayers
             } elseif ($v instanceof Collection) {
                 return $v->push($val);
             }
-            return $v . $val;
+
+            return $v.$val;
         });
     }
 
@@ -141,12 +147,15 @@ trait HasDisplayers
      * Split a string by string
      *
      * @param string $d
+     *
      * @return $this
      */
     public function explode(string $d = ',')
     {
         return $this->display(function ($v) use ($d) {
-            if (is_array($v) || $v instanceof Arrayable) return $v;
+            if (is_array($v) || $v instanceof Arrayable) {
+                return $v;
+            }
 
             return $v ? explode($d, $v) : [];
         });
@@ -175,8 +184,9 @@ trait HasDisplayers
     /**
      * Limit the number of characters in a string.
      *
-     * @param  int     $limit
-     * @param  string  $end
+     * @param  int    $limit
+     * @param  string $end
+     *
      * @return $this
      */
     public function limit($limit = 100, $end = '...')
@@ -197,5 +207,4 @@ trait HasDisplayers
     {
         return $this->display('');
     }
-
 }

+ 4 - 3
src/Grid/Column/HasHeader.php

@@ -47,7 +47,7 @@ trait HasHeader
      *
      * @param string $cast
      *
-     * @return Column|string
+     * @return $this
      */
     protected function addSorter($cast = null)
     {
@@ -62,8 +62,8 @@ trait HasHeader
      * Add a help tooltip to column header.
      *
      * @param string|\Closure $message
-     * @param null|string $style 'green', 'blue', 'red', 'purple'
-     * @param null|string $placement 'bottom', 'left', 'right', 'top'
+     * @param null|string     $style 'green', 'blue', 'red', 'purple'
+     * @param null|string     $placement 'bottom', 'left', 'right', 'top'
      *
      * @return $this
      */
@@ -76,6 +76,7 @@ trait HasHeader
      * Add a filter to column header.
      *
      * @param \Closure $builder
+     *
      * @return $this
      */
     protected function addFilter(Filter $filter)

+ 2 - 3
src/Grid/Column/Help.php

@@ -30,8 +30,8 @@ class Help implements Renderable
      */
     public function __construct($message = '', ?string $style = null, ?string $placement = 'bottom')
     {
-        $this->message   = value($message);
-        $this->style     = $style;
+        $this->message = value($message);
+        $this->style = $style;
         $this->placement = $placement;
     }
 
@@ -63,5 +63,4 @@ class Help implements Renderable
 </a>
 HELP;
     }
-
 }

+ 4 - 4
src/Grid/Column/Sorter.php

@@ -65,9 +65,9 @@ class Sorter implements Renderable
      */
     public function render()
     {
-        $icon  = '';
+        $icon = '';
         $color = '';
-        $type  = 'desc';
+        $type = 'desc';
 
         if ($this->isSorted()) {
             $type = $this->sort['type'] == 'desc' ? 'asc' : 'desc';
@@ -84,9 +84,9 @@ class Sorter implements Renderable
             $sort['cast'] = $this->cast;
         }
 
-        if (! $this->isSorted() || $this->sort['type'] != 'asc') {
+        if (!$this->isSorted() || $this->sort['type'] != 'asc') {
             $url = request()->fullUrlWithQuery([
-                $this->sortName => $sort
+                $this->sortName => $sort,
             ]);
         } else {
             $url = request()->fullUrlWithQuery([

+ 6 - 4
src/Grid/Concerns/HasActions.php

@@ -4,7 +4,6 @@ namespace Dcat\Admin\Grid\Concerns;
 
 use Closure;
 use Dcat\Admin\Grid;
-use Dcat\Admin\Grid\Displayers;
 
 trait HasActions
 {
@@ -36,7 +35,6 @@ trait HasActions
         return $this;
     }
 
-
     /**
      * Get action display class.
      *
@@ -55,7 +53,6 @@ trait HasActions
         return Grid\Displayers\Actions::class;
     }
 
-
     /**
      * Set grid action callback.
      *
@@ -109,6 +106,7 @@ trait HasActions
      * Disable edit.
      *
      * @param bool $disable
+     *
      * @return $this
      */
     public function disableEditButton(bool $disable = true)
@@ -122,6 +120,7 @@ trait HasActions
      * Show edit.
      *
      * @param bool $val
+     *
      * @return $this
      */
     public function showEditButton(bool $val = true)
@@ -155,6 +154,7 @@ trait HasActions
      * Disable view action.
      *
      * @param bool $disable
+     *
      * @return $this
      */
     public function disableViewButton(bool $disable = true)
@@ -168,6 +168,7 @@ trait HasActions
      * Show view action.
      *
      * @param bool $disable
+     *
      * @return $this
      */
     public function showViewButton(bool $val = true)
@@ -179,6 +180,7 @@ trait HasActions
      * Disable delete.
      *
      * @param bool $disable
+     *
      * @return $this
      */
     public function disableDeleteButton(bool $disable = true)
@@ -192,11 +194,11 @@ trait HasActions
      * Show delete button.
      *
      * @param bool $disable
+     *
      * @return $this
      */
     public function showDeleteButton(bool $val = true)
     {
         return $this->disableDeleteButton(!$val);
     }
-
 }

+ 6 - 7
src/Grid/Concerns/HasExporter.php

@@ -2,9 +2,9 @@
 
 namespace Dcat\Admin\Grid\Concerns;
 
+use Dcat\Admin\Grid;
 use Dcat\Admin\Grid\Exporter;
 use Dcat\Admin\Grid\Exporters\AbstractExporter;
-use Dcat\Admin\Grid;
 use Dcat\Admin\Grid\Tools;
 
 trait HasExporter
@@ -33,7 +33,7 @@ trait HasExporter
         $titles = [];
 
         if (is_array($exporter) || $exporter === false) {
-            $titles   = $exporter;
+            $titles = $exporter;
             $exporter = null;
         }
 
@@ -86,7 +86,7 @@ trait HasExporter
      */
     public function setExporterQueryName($gridName)
     {
-        if (! $this->allowExporter()) {
+        if (!$this->allowExporter()) {
             return;
         }
 
@@ -100,7 +100,7 @@ trait HasExporter
      */
     protected function resolveExportDriver($scope)
     {
-        if (! $this->exportDriver) {
+        if (!$this->exportDriver) {
             $this->exportDriver = $this->getExporter()->resolve();
         }
 
@@ -134,7 +134,7 @@ trait HasExporter
      */
     public function renderExportButton()
     {
-        if (! $this->allowExporter()) {
+        if (!$this->allowExporter()) {
             return '';
         }
         
@@ -148,7 +148,7 @@ trait HasExporter
      */
     public function disableExporter(bool $disable = true)
     {
-        return $this->option('show_exporter', ! $disable);
+        return $this->option('show_exporter', !$disable);
     }
 
     /**
@@ -170,5 +170,4 @@ trait HasExporter
     {
         return $this->options['show_exporter'];
     }
-
 }

+ 4 - 0
src/Grid/Concerns/HasFilter.php

@@ -59,6 +59,7 @@ trait HasFilter
      * Set the grid filter.
      *
      * @param Closure $callback
+     *
      * @return $this
      */
     public function filter(Closure $callback)
@@ -111,6 +112,7 @@ trait HasFilter
      * Show grid filter.
      *
      * @param bool $val
+     *
      * @return $this
      */
     public function showFilter(bool $val = true)
@@ -122,6 +124,7 @@ trait HasFilter
      * Disable filter button.
      *
      * @param bool $disable
+     *
      * @return $this
      */
     public function disableFilterButton(bool $disable = true)
@@ -135,6 +138,7 @@ trait HasFilter
      * Show filter button.
      *
      * @param bool $val
+     *
      * @return $this
      */
     public function showFilterButton(bool $val = true)

+ 7 - 3
src/Grid/Concerns/HasMultipleHeader.php

@@ -18,7 +18,7 @@ trait HasMultipleHeader
      * Merge cells.
      *
      * @param string $label
-     * @param array $columnNames
+     * @param array  $columnNames
      *
      * @return Header
      */
@@ -27,6 +27,7 @@ trait HasMultipleHeader
         if (count($columnNames) < 2) {
             throw new \InvalidArgumentException('The number of "$columnNames" must be greater than 2');
         }
+
         $this->withBorder();
 
         return $this->mutipleHeaders[$label] = new Header($this, $label, $columnNames);
@@ -99,20 +100,23 @@ trait HasMultipleHeader
     protected function createHeaderWithColumns(array $columns)
     {
         $headers = [];
+
         /* @var Column $column */
         foreach ($columns as $name => $column) {
             $header = new Header($this, $column->getLabel(), [$name]);
             $prio = $column->getDataPriority();
+
             if (is_int($prio)) {
                 $header->responsive($prio);
             }
+
             if ($html = $column->renderHeader()) {
                 $header->append($html);
             }
+
             $headers[] = $header;
         }
+
         return $headers;
     }
-
-
 }

+ 1 - 1
src/Grid/Concerns/HasPaginator.php

@@ -104,11 +104,11 @@ trait HasPaginator
      * Show grid pagination.
      *
      * @param bool $val
+     *
      * @return $this
      */
     public function showPagination(bool $val = true)
     {
         return $this->disablePagination(!$val);
     }
-
 }

+ 14 - 18
src/Grid/Concerns/HasQuickSearch.php

@@ -3,9 +3,9 @@
 namespace Dcat\Admin\Grid\Concerns;
 
 use Dcat\Admin\Grid\Column;
+use Dcat\Admin\Grid\Model;
 use Dcat\Admin\Grid\Tools;
 use Illuminate\Support\Collection;
-use Dcat\Admin\Grid\Model;
 use Illuminate\Support\Str;
 
 /**
@@ -73,7 +73,7 @@ trait HasQuickSearch
      */
     public function renderQuickSearch()
     {
-        if (! $this->quickSearch) {
+        if (!$this->quickSearch) {
             return '';
         }
 
@@ -87,11 +87,11 @@ trait HasQuickSearch
      */
     public function applyQuickSearch()
     {
-        if (! $this->quickSearch) {
+        if (!$this->quickSearch) {
             return;
         }
 
-        if (! $query = request()->get($this->quickSearch->getQueryName())) {
+        if (!$query = request()->get($this->quickSearch->getQueryName())) {
             return;
         }
 
@@ -105,14 +105,11 @@ trait HasQuickSearch
 
         if (is_array($this->search)) {
             foreach ($this->search as $column) {
-                $this->addWhereLikeBinding($column, true, '%' . $query . '%');
+                $this->addWhereLikeBinding($column, true, '%'.$query.'%');
             }
-
         } elseif (is_null($this->search)) {
             $this->addWhereBindings($query);
-
         }
-
     }
 
     /**
@@ -123,7 +120,7 @@ trait HasQuickSearch
     protected function addWhereBindings($query)
     {
         $queries = preg_split('/\s(?=([^"]*"[^"]*")*[^"]*$)/', trim($query));
-        if (! $queries = $this->parseQueryBindings($queries)) {
+        if (!$queries = $this->parseQueryBindings($queries)) {
             $this->addWhereBasicBinding($this->getKeyName(), false, '=', '___');
 
             return;
@@ -131,7 +128,7 @@ trait HasQuickSearch
 
         foreach ($queries as list($column, $condition, $or)) {
             if (preg_match('/(?<not>!?)\((?<values>.+)\)/', $condition, $match) !== 0) {
-                $this->addWhereInBinding($column, $or, (bool)$match['not'], $match['values']);
+                $this->addWhereInBinding($column, $or, (bool) $match['not'], $match['values']);
                 continue;
             }
 
@@ -211,7 +208,7 @@ trait HasQuickSearch
      * Add where like binding to model query.
      *
      * @param string $column
-     * @param bool $or
+     * @param bool   $or
      * @param string $pattern
      */
     protected function addWhereLikeBinding(?string $column, ?bool $or, ?string $pattern)
@@ -232,7 +229,7 @@ trait HasQuickSearch
      */
     protected function addWhereDatetimeBinding(?string $column, ?bool $or, ?string $function, ?string $value)
     {
-        $method = ($or ? 'orWhere' : 'where') . ucfirst($function);
+        $method = ($or ? 'orWhere' : 'where').ucfirst($function);
 
         $this->model()->$method($column, $value);
     }
@@ -241,8 +238,8 @@ trait HasQuickSearch
      * Add where in binding to the model query.
      *
      * @param string $column
-     * @param bool $or
-     * @param bool $not
+     * @param bool   $or
+     * @param bool   $not
      * @param string $values
      */
     protected function addWhereInBinding(?string $column, ?bool $or, ?bool $not, ?string $values)
@@ -256,7 +253,7 @@ trait HasQuickSearch
         }
 
         $where = $or ? 'orWhere' : 'where';
-        $method = $where . ($not ? 'NotIn' : 'In');
+        $method = $where.($not ? 'NotIn' : 'In');
 
         $this->model()->$method($column, $values);
     }
@@ -265,7 +262,7 @@ trait HasQuickSearch
      * Add where between binding to the model query.
      *
      * @param string $column
-     * @param bool $or
+     * @param bool   $or
      * @param string $start
      * @param string $end
      */
@@ -280,7 +277,7 @@ trait HasQuickSearch
      * Add where basic binding to the model query.
      *
      * @param string $column
-     * @param bool $or
+     * @param bool   $or
      * @param string $operator
      * @param string $value
      */
@@ -303,5 +300,4 @@ trait HasQuickSearch
 
         $this->model()->{$method}($column, $operator, $value);
     }
-
 }

+ 14 - 7
src/Grid/Concerns/HasTools.php

@@ -72,6 +72,7 @@ trait HasTools
 
     /**
      * @param bool $val
+     *
      * @return mixed
      */
     public function disableToolbar(bool $val = true)
@@ -81,6 +82,7 @@ trait HasTools
 
     /**
      * @param bool $val
+     *
      * @return mixed
      */
     public function showToolbar(bool $val = true)
@@ -92,6 +94,7 @@ trait HasTools
      * Disable batch actions.
      *
      * @param bool $disable
+     *
      * @return $this
      */
     public function disableBatchActions(bool $disable = true)
@@ -105,6 +108,7 @@ trait HasTools
      * Show batch actions.
      *
      * @param bool $val
+     *
      * @return $this
      */
     public function showBatchActions(bool $val = true)
@@ -116,6 +120,7 @@ trait HasTools
      * Disable batch delete.
      *
      * @param bool $disable
+     *
      * @return $this
      */
     public function disableBatchDelete(bool $disable = true)
@@ -131,6 +136,7 @@ trait HasTools
      * Show batch delete.
      *
      * @param bool $val
+     *
      * @return $this
      */
     public function showBatchDelete(bool $val = true)
@@ -142,6 +148,7 @@ trait HasTools
      * Disable refresh button.
      *
      * @param bool $disable
+     *
      * @return $this
      */
     public function disableRefreshButton(bool $disable = true)
@@ -155,6 +162,7 @@ trait HasTools
      * Show refresh button.
      *
      * @param bool $val
+     *
      * @return $this
      */
     public function showRefreshButton(bool $val = true)
@@ -173,12 +181,12 @@ trait HasTools
         if (
             $this->option('show_toolbar')
             && (
-                $this->getTools()->has() ||
-                $this->allowExporter() ||
-                $this->allowCreateBtn() ||
-                $this->allowQuickCreateBtn() ||
-                $this->allowResponsive() ||
-                !empty($this->variables['title'])
+                $this->getTools()->has()
+                || $this->allowExporter()
+                || $this->allowCreateBtn()
+                || $this->allowQuickCreateBtn()
+                || $this->allowResponsive()
+                || !empty($this->variables['title'])
             )
         ) {
             return true;
@@ -186,5 +194,4 @@ trait HasTools
 
         return false;
     }
-
 }

+ 4 - 3
src/Grid/Displayers/AbstractDisplayer.php

@@ -50,10 +50,10 @@ abstract class AbstractDisplayer
      */
     public function __construct($value, Grid $grid, Column $column, $row)
     {
-        $this->value  = $value;
-        $this->grid   = $grid;
+        $this->value = $value;
+        $this->grid = $grid;
         $this->column = $column;
-        $this->row    = $row;
+        $this->row = $row;
 
         $this->collectAssets();
 
@@ -67,6 +67,7 @@ abstract class AbstractDisplayer
         if (static::$js) {
             Admin::js(static::$js);
         }
+
         if (static::$css) {
             Admin::css(static::$css);
         }

+ 2 - 4
src/Grid/Displayers/Actions.php

@@ -2,7 +2,6 @@
 
 namespace Dcat\Admin\Grid\Displayers;
 
-use Dcat\Admin\Admin;
 use Dcat\Admin\Form;
 use Dcat\Admin\Support\Helper;
 
@@ -167,8 +166,8 @@ class Actions extends AbstractDisplayer
         $map = [Helper::class, 'render'];
 
         $prepends = array_map($map, $this->prepends);
-        $appends  = array_map($map, $this->appends);
-        $actions  = &$prepends;
+        $appends = array_map($map, $this->appends);
+        $actions = &$prepends;
 
         foreach ($this->actions as $action) {
             $method = 'render'.ucfirst($action);
@@ -230,7 +229,6 @@ EOT;
     <i class=" fa fa-clone grid-action-icon"></i>
 </a>&nbsp;
 EOF;
-
     }
 
     /**

+ 1 - 2
src/Grid/Displayers/Checkbox.php

@@ -26,7 +26,7 @@ class Checkbox extends AbstractDisplayer
         }
 
         foreach ($options as $value => $label) {
-            $id = 'ckb'.\Illuminate\Support\Str::random(8);
+            $id = 'ckb'.Str::random(8);
 
             $checked = in_array($value, $this->value) ? 'checked' : '';
             $radios .= <<<EOT
@@ -93,7 +93,6 @@ $('form.grid-checkbox-$name').on('submit', function () {
 
     return false;
 });
-
 JS;
     }
 }

+ 0 - 1
src/Grid/Displayers/Copyable.php

@@ -43,5 +43,4 @@ JS;
 </a>&nbsp;{$this->value}
 HTML;
     }
-
 }

+ 1 - 2
src/Grid/Displayers/Downloadable.php

@@ -17,7 +17,7 @@ class Downloadable extends AbstractDisplayer
             if (url()->isValidUrl($value)) {
                 $src = $value;
             } elseif ($server) {
-                $src = rtrim($server, '/') . '/' . ltrim($value, '/');
+                $src = rtrim($server, '/').'/'.ltrim($value, '/');
             } else {
                 $src = Storage::disk($disk ?: config('admin.upload.disk'))->url($value);
             }
@@ -31,5 +31,4 @@ class Downloadable extends AbstractDisplayer
 HTML;
         })->implode('<br>');
     }
-
 }

+ 3 - 3
src/Grid/Displayers/DropdownActions.php

@@ -2,12 +2,12 @@
 
 namespace Dcat\Admin\Grid\Displayers;
 
-use Dcat\Admin\Grid\Actions\QuickEdit;
-use Dcat\Admin\Grid\RowAction;
 use Dcat\Admin\Admin;
 use Dcat\Admin\Grid\Actions\Delete;
 use Dcat\Admin\Grid\Actions\Edit;
+use Dcat\Admin\Grid\Actions\QuickEdit;
 use Dcat\Admin\Grid\Actions\Show;
+use Dcat\Admin\Grid\RowAction;
 use Dcat\Admin\Support\Helper;
 use Dcat\Admin\Widgets\Color;
 use Illuminate\Contracts\Support\Renderable;
@@ -37,7 +37,7 @@ class DropdownActions extends Actions
     protected function addScript()
     {
         $background = $this->grid->option('row_selector_bg') ?: Color::dark20();
-        $checkbox   = ".{$this->grid->getGridRowName()}-checkbox";
+        $checkbox = ".{$this->grid->getGridRowName()}-checkbox";
 
         $script = <<<JS
 $(function() {

+ 1 - 1
src/Grid/Displayers/Editable.php

@@ -169,7 +169,7 @@ class Editable extends AbstractDisplayer
     {
         if (!static::$setup) {
             static::$setup = 1;
-            Admin::script(<<<JS
+            Admin::script(<<<'JS'
 $.fn.editable.defaults.params = function (params) {
     params._token = LA.token;
     params._editable = 1;

+ 1 - 1
src/Grid/Displayers/Expand.php

@@ -29,7 +29,7 @@ class Expand extends AbstractDisplayer
             if ($html instanceof Renderable) {
                 $html = $html->render();
             }
-        }  elseif ($callbackOrButton && is_string($callbackOrButton)) {
+        } elseif ($callbackOrButton && is_string($callbackOrButton)) {
             $this->button = $callbackOrButton;
         }
 

+ 0 - 3
src/Grid/Displayers/Link.php

@@ -10,13 +10,10 @@ class Link extends AbstractDisplayer
             $href = $href->bindTo($this->row);
 
             $href = call_user_func($href, $this->value);
-
         } else {
             $href = $href ?: $this->value;
-
         }
 
         return "<a href='$href' target='$target'>{$this->value}</a>";
     }
-    
 }

+ 1 - 2
src/Grid/Displayers/Orderable.php

@@ -12,7 +12,7 @@ class Orderable extends AbstractDisplayer
     {
         parent::__construct($value, $grid, $column, $row);
 
-        if (! trait_exists('\Spatie\EloquentSortable\SortableTrait')) {
+        if (!trait_exists('\Spatie\EloquentSortable\SortableTrait')) {
             throw new \Exception('To use orderable grid, please install package [spatie/eloquent-sortable] first.');
         }
     }
@@ -31,7 +31,6 @@ class Orderable extends AbstractDisplayer
         <i class="fa fa-hand-o-down fa-fw"></i>
     </a>
 </div>
-
 EOT;
     }
 

+ 0 - 1
src/Grid/Displayers/QRCode.php

@@ -39,5 +39,4 @@ JS;
 </a>&nbsp;{$this->value}
 HTML;
     }
-
 }

+ 2 - 3
src/Grid/Displayers/RowSelector.php

@@ -11,7 +11,7 @@ class RowSelector extends AbstractDisplayer
     {
         $this->setupScript();
 
-        $style  = $this->grid->option('row_selector_style');
+        $style = $this->grid->option('row_selector_style');
         $circle = $this->grid->option('row_selector_circle') ? 'checkbox-circle' : '';
 
         return <<<EOT
@@ -24,7 +24,7 @@ EOT;
 
     protected function setupScript()
     {
-        $clickTr    = $this->grid->option('row_selector_clicktr') ? 'true' : 'false';
+        $clickTr = $this->grid->option('row_selector_clicktr') ? 'true' : 'false';
         $background = $this->grid->option('row_selector_bg') ?: Color::dark20();
 
         Admin::script(
@@ -55,5 +55,4 @@ JS
 
         return $label ?: ($this->row->username ?: $this->getKey());
     }
-
 }

+ 5 - 6
src/Grid/Displayers/SwitchDisplay.php

@@ -45,7 +45,8 @@ class SwitchDisplay extends AbstractDisplayer
     /**
      * Set color of the switcher.
      *
-     * @param $color
+     * @param string $color
+     *
      * @return $this
      */
     public function color($color)
@@ -69,10 +70,10 @@ class SwitchDisplay extends AbstractDisplayer
 
         $this->setupScript();
 
-        $name    = $this->getElementName();
-        $key     = $this->row->{$this->grid->getKeyName()};
+        $name = $this->getElementName();
+        $key = $this->row->{$this->grid->getKeyName()};
         $checked = $this->value ? 'checked' : '';
-        $color   = $this->color ?: Color::primary();
+        $color = $this->color ?: Color::primary();
 
         return <<<EOF
 <input class="grid-switch-{$this->grid->getName()}" data-size="small" name="{$name}" data-key="$key" {$checked} type="checkbox" data-color="{$color}"/>
@@ -122,6 +123,4 @@ JS
     {
         Admin::collectComponentAssets('switchery');
     }
-
-
 }

+ 3 - 3
src/Grid/Displayers/SwitchGroup.php

@@ -22,7 +22,7 @@ class SwitchGroup extends SwitchDisplay
         }
 
         if (!Arr::isAssoc($columns)) {
-            $labels  = array_map('admin_trans_field', $columns);
+            $labels = array_map('admin_trans_field', $columns);
             $columns = array_combine($columns, $labels);
         }
 
@@ -43,7 +43,7 @@ class SwitchGroup extends SwitchDisplay
         if ($keys->isEmpty()) {
             $elementName = $name;
         } else {
-            $elementName = $keys->shift() . $keys->reduce(function ($carry, $val) {
+            $elementName = $keys->shift().$keys->reduce(function ($carry, $val) {
                 return "{$carry}[{$val}]";
             });
         }
@@ -84,7 +84,7 @@ class SwitchGroup extends SwitchDisplay
 JS;
         Admin::script($script);
 
-        $key     = $this->row->{$this->grid->getKeyName()};
+        $key = $this->row->{$this->grid->getKeyName()};
         $checked = $this->row->$name ? 'checked' : '';
 
         return <<<EOT

+ 15 - 11
src/Grid/Displayers/Tree.php

@@ -16,11 +16,11 @@ class Tree extends AbstractDisplayer
 
     protected $options = [
         'plugins' => ['checkbox', 'types'],
-        'core' => [
+        'core'    => [
             'check_callback' => true,
 
             'themes' => [
-                'name' => 'proton',
+                'name'       => 'proton',
                 'responsive' => true,
             ],
         ],
@@ -49,14 +49,15 @@ class Tree extends AbstractDisplayer
 
     /**
      * @param array $data exp:
-     *     {
-     *          "id": "1",
-     *          "parent": "#",
-     *          "text": "Dashboard",
-     *          // "state": {"selected": true}
-     *     }
+     *                    {
+     *                    "id": "1",
+     *                    "parent": "#",
+     *                    "text": "Dashboard",
+     *                    // "state": {"selected": true}
+     *                    }
      *
      * @param array $data
+     *
      * @return $this
      */
     public function nodes($data)
@@ -64,6 +65,7 @@ class Tree extends AbstractDisplayer
         if ($data instanceof Arrayable) {
             $data = $data->toArray();
         }
+
         $this->nodes = &$data;
 
         return $this;
@@ -84,8 +86,8 @@ class Tree extends AbstractDisplayer
     }
 
     /**
-     *
      * @param array $options
+     *
      * @return $this
      */
     public function options($options = [])
@@ -109,6 +111,7 @@ class Tree extends AbstractDisplayer
     /**
      * @param string $width
      * @param string $height
+     *
      * @return $this
      */
     public function area(string $width, string $height)
@@ -122,12 +125,13 @@ class Tree extends AbstractDisplayer
      * @param string $idColumn
      * @param string $textColumn
      * @param string $parentColumn
+     *
      * @return $this
      */
     public function columnNames(string $idColumn = 'id', string $textColumn = 'name', string $parentColumn = 'parent_id')
     {
-        $this->columnNames['id']     = $idColumn;
-        $this->columnNames['text']   = $textColumn;
+        $this->columnNames['id'] = $idColumn;
+        $this->columnNames['text'] = $textColumn;
         $this->columnNames['parent'] = $parentColumn;
 
         return $this;

+ 11 - 6
src/Grid/Exporter.php

@@ -70,8 +70,9 @@ class Exporter
     /**
      *  Get or set option for exporter.
      *
-     * @param string $key
+     * @param string     $key
      * @param mixed|null $value
+     *
      * @return $this|mixed|null
      */
     public function option($key, $value = null)
@@ -89,37 +90,41 @@ class Exporter
      * Disable export all.
      *
      * @param bool $value
+     *
      * @return $this
      */
     public function disableExportAll(bool $value = true)
     {
-        return $this->option('show_export_all', ! $value);
+        return $this->option('show_export_all', !$value);
     }
 
     /**
      * Disable export current page.
      *
      * @param bool $value
+     *
      * @return $this
      */
     public function disableExportCurrentPage(bool $value = true)
     {
-        return $this->option('show_export_current_page', ! $value);
+        return $this->option('show_export_current_page', !$value);
     }
 
     /**
      * Disable export selected rows.
      *
      * @param bool $value
+     *
      * @return $this
      */
     public function disableExportSelectedRow(bool $value = true)
     {
-        return $this->option('show_export_selected_rows', ! $value);
+        return $this->option('show_export_selected_rows', !$value);
     }
 
     /**
      * @param int $value
+     *
      * @return $this
      */
     public function chunkSize(int $value)
@@ -177,11 +182,11 @@ class Exporter
      */
     protected function getExporter($driver): ExporterInterface
     {
-        if (! $driver || ! array_key_exists($driver, static::$drivers)) {
+        if (!$driver || !array_key_exists($driver, static::$drivers)) {
             return $this->getDefaultExporter();
         }
 
-        $driver = (new static::$drivers[$driver]());
+        $driver = new static::$drivers[$driver]();
 
         if (method_exists($driver, 'setGrid')) {
             $driver->setGrid($this->grid);

+ 11 - 7
src/Grid/Exporters/AbstractExporter.php

@@ -3,7 +3,6 @@
 namespace Dcat\Admin\Grid\Exporters;
 
 use Dcat\Admin\Grid;
-use Illuminate\Support\Collection;
 use Illuminate\Support\Str;
 
 /**
@@ -67,6 +66,7 @@ abstract class AbstractExporter implements ExporterInterface
      * Set the headings of excel sheet.
      *
      * @param array|false $titles
+     *
      * @return $this
      */
     public function titles($titles)
@@ -82,6 +82,7 @@ abstract class AbstractExporter implements ExporterInterface
      * Set filename.
      *
      * @param string|\Closure $filename
+     *
      * @return $this
      */
     public function filename($filename)
@@ -95,6 +96,7 @@ abstract class AbstractExporter implements ExporterInterface
      * Set export data.
      *
      * @param array $data
+     *
      * @return $this
      */
     public function data($data)
@@ -108,6 +110,7 @@ abstract class AbstractExporter implements ExporterInterface
      * Set export data callback function.
      *
      * @param \Closure $builder
+     *
      * @return $this
      */
     public function rows(\Closure $builder)
@@ -143,6 +146,7 @@ abstract class AbstractExporter implements ExporterInterface
 
     /**
      * @param string $ext e.g. csv/xlsx/ods
+     *
      * @return $this
      */
     public function extension(string $ext)
@@ -161,7 +165,7 @@ abstract class AbstractExporter implements ExporterInterface
      */
     public function setGrid(Grid $grid)
     {
-        $this->grid   = $grid;
+        $this->grid = $grid;
         $this->parent = $grid->getExporter();
 
         return $this;
@@ -181,11 +185,12 @@ abstract class AbstractExporter implements ExporterInterface
      *
      * @param int $page
      * @param int $perPage
+     *
      * @return array|\Illuminate\Support\Collection|mixed
      */
     public function buildData(?int $page = null, ?int $perPage = null)
     {
-        if (! is_null($this->data)) {
+        if (!is_null($this->data)) {
             return $this->data;
         }
 
@@ -193,7 +198,7 @@ abstract class AbstractExporter implements ExporterInterface
 
         // current page
         if ($this->scope === Grid\Exporter::SCOPE_CURRENT_PAGE) {
-            $page    = $model->getCurrentPage();
+            $page = $model->getCurrentPage();
             $perPage = $model->getPerPage();
         }
 
@@ -235,9 +240,8 @@ abstract class AbstractExporter implements ExporterInterface
     public function withScope($scope)
     {
         $data = explode(':', $scope);
-
         $scope = $data[0] ?? '';
-        $args  = $data[1] ?? '';
+        $args = $data[1] ?? '';
 
         $this->scope = $scope;
 
@@ -258,6 +262,7 @@ abstract class AbstractExporter implements ExporterInterface
     /**
      * @param $method
      * @param $arguments
+     *
      * @return mixed
      */
     public function __call($method, $arguments)
@@ -276,5 +281,4 @@ abstract class AbstractExporter implements ExporterInterface
     {
         return new static($builder);
     }
-
 }

+ 2 - 3
src/Grid/Exporters/ExcelExporter.php

@@ -2,8 +2,8 @@
 
 namespace Dcat\Admin\Grid\Exporters;
 
-use Dcat\EasyExcel\Excel;
 use Dcat\Admin\Grid;
+use Dcat\EasyExcel\Excel;
 
 class ExcelExporter extends AbstractExporter
 {
@@ -11,7 +11,7 @@ class ExcelExporter extends AbstractExporter
     {
         parent::__construct($titles);
 
-        if (! class_exists(Excel::class)) {
+        if (!class_exists(Excel::class)) {
             throw new \Exception('To use exporter, please install [dcat/easy-excel] first.');
         }
     }
@@ -37,5 +37,4 @@ class ExcelExporter extends AbstractExporter
 
         exit;
     }
-
 }

+ 13 - 12
src/Grid/Filter.php

@@ -31,8 +31,8 @@ use Dcat\Admin\Traits\HasBuilderEvents;
 use Illuminate\Contracts\Support\Arrayable;
 use Illuminate\Contracts\Support\Renderable;
 use Illuminate\Support\Arr;
-use Illuminate\Support\Str;
 use Illuminate\Support\Collection;
+use Illuminate\Support\Str;
 
 /**
  * Class Filter.
@@ -248,6 +248,7 @@ class Filter implements Renderable
 
     /**
      * @param bool $disabled
+     *
      * @return $this
      */
     public function disableCollapse(bool $disabled = true)
@@ -259,6 +260,7 @@ class Filter implements Renderable
 
     /**
      * @param bool $disabled
+     *
      * @return $this
      */
     public function disableResetButton(bool $disabled = true)
@@ -287,7 +289,6 @@ class Filter implements Renderable
         return Arr::get($inputs, $key, $default);
     }
 
-
     /**
      * Get grid model.
      *
@@ -333,7 +334,7 @@ class Filter implements Renderable
     }
 
     /**
-     * @param $name
+     * @param string $name
      *
      * @return $this
      */
@@ -375,7 +376,7 @@ class Filter implements Renderable
     {
         $this->filters = array_filter($this->filters, function (AbstractFilter $filter) use (&$column) {
             if (is_array($column)) {
-                return ! in_array($filter->getColumn(), $column);
+                return !in_array($filter->getColumn(), $column);
             }
 
             return $filter->getColumn() != $column;
@@ -589,6 +590,7 @@ class Filter implements Renderable
      * @param string $right
      * @param string $bottom
      * @param string $left
+     *
      * @return Filter
      */
     public function padding($top = '15px', $right = '15px', $bottom = '5px', $left = '')
@@ -599,6 +601,7 @@ class Filter implements Renderable
     /**
      *
      * @param string $style
+     *
      * @return $this
      */
     public function style(?string $style)
@@ -634,13 +637,12 @@ class Filter implements Renderable
         $this->callComposing();
 
         return view($this->view)->with([
-            'action'   => $this->action ?: $this->urlWithoutFilters(),
-            'layout'   => $this->layout,
-            'filterID' => $this->disableCollapse ? '' : $this->filterID,
-            'expand'   => $this->expand,
-            'style'    => $this->style,
-            'border'   => $this->border,
-
+            'action'             => $this->action ?: $this->urlWithoutFilters(),
+            'layout'             => $this->layout,
+            'filterID'           => $this->disableCollapse ? '' : $this->filterID,
+            'expand'             => $this->expand,
+            'style'              => $this->style,
+            'border'             => $this->border,
             'containerClass'     => $this->containerClass,
             'disableResetButton' => $this->disableResetButton,
         ])->render();
@@ -754,5 +756,4 @@ class Filter implements Renderable
     {
         return static::$supports;
     }
-
 }

+ 6 - 4
src/Grid/Filter/AbstractFilter.php

@@ -2,7 +2,6 @@
 
 namespace Dcat\Admin\Grid\Filter;
 
-use Dcat\Admin\Admin;
 use Dcat\Admin\Grid\Filter;
 use Dcat\Admin\Grid\Filter\Presenter\Checkbox;
 use Dcat\Admin\Grid\Filter\Presenter\DateTime;
@@ -108,7 +107,7 @@ abstract class AbstractFilter
     public function __construct($column, $label = '')
     {
         $this->column = $column;
-        $this->label  = $this->formatLabel($label);
+        $this->label = $this->formatLabel($label);
     }
 
     /**
@@ -139,6 +138,7 @@ abstract class AbstractFilter
      * Set the column width.
      *
      * @param int|string $width
+     *
      * @return $this
      */
     public function width($width)
@@ -287,7 +287,8 @@ abstract class AbstractFilter
     }
 
     /**
-     * @param null $source
+     * @param mixed $source
+     *
      * @return Filter\Presenter\SelectResource
      */
     public function selectResource($source = null)
@@ -475,7 +476,8 @@ abstract class AbstractFilter
     }
 
     /**
-     * @param $value
+     * @param mixed $value
+     *
      * @return $this
      */
     public function setValue($value)

+ 2 - 2
src/Grid/Filter/Between.php

@@ -39,7 +39,7 @@ class Between extends AbstractFilter
      */
     public function formatId($column)
     {
-        $id     = str_replace('.', '_', $column);
+        $id = str_replace('.', '_', $column);
         $prefix = 'filter_column_'.$this->parent->getGrid()->getName().'_';
 
         return ['start' => "{$prefix}{$id}_start", 'end' => "{$prefix}{$id}_end"];
@@ -61,7 +61,7 @@ class Between extends AbstractFilter
         if (count($columns) == 1) {
             $name = $prefix.$columns[0];
         } else {
-            $name =  $prefix.array_shift($columns);
+            $name = $prefix.array_shift($columns);
 
             foreach ($columns as $column) {
                 $name .= "[$column]";

+ 3 - 3
src/Grid/Filter/Group.php

@@ -35,8 +35,8 @@ class Group extends AbstractFilter
     public function __construct($column, \Closure $builder = null, $label = '')
     {
         $this->builder = $builder;
-        $this->column  = $column;
-        $this->label   = $this->formatLabel($label);
+        $this->column = $column;
+        $this->label = $this->formatLabel($label);
 
         $this->initialize();
     }
@@ -47,7 +47,7 @@ class Group extends AbstractFilter
     protected function initialize()
     {
         $this->group = new Collection();
-        $this->name  = "{$this->id}-filter-group";
+        $this->name = "{$this->id}-filter-group";
     }
 
     /**

+ 0 - 1
src/Grid/Filter/Layout/Layout.php

@@ -82,5 +82,4 @@ class Layout
 
         return $this->columns;
     }
-
 }

+ 0 - 2
src/Grid/Filter/Presenter/Checkbox.php

@@ -2,8 +2,6 @@
 
 namespace Dcat\Admin\Grid\Filter\Presenter;
 
-use Dcat\Admin\Admin;
-
 class Checkbox extends Radio
 {
     protected function prepare()

+ 1 - 1
src/Grid/Filter/Presenter/DateTime.php

@@ -32,7 +32,7 @@ class DateTime extends Presenter
      *
      * @return mixed
      */
-    protected function getOptions(array  $options) : array
+    protected function getOptions(array $options): array
     {
         $options['format'] = Arr::get($options, 'format', $this->format);
         $options['locale'] = Arr::get($options, 'locale', config('app.locale'));

+ 2 - 1
src/Grid/Filter/Presenter/Presenter.php

@@ -48,11 +48,13 @@ abstract class Presenter
 
     /**
      * @param int $width
+     *
      * @return $this
      */
     public function width($width)
     {
         $this->filter->width($width);
+
         return $this;
     }
 
@@ -100,5 +102,4 @@ abstract class Presenter
             Admin::css(static::$css);
         }
     }
-
 }

+ 0 - 1
src/Grid/Filter/Presenter/Radio.php

@@ -2,7 +2,6 @@
 
 namespace Dcat\Admin\Grid\Filter\Presenter;
 
-use Dcat\Admin\Admin;
 use Illuminate\Contracts\Support\Arrayable;
 
 class Radio extends Presenter

+ 7 - 9
src/Grid/Filter/Presenter/Select.php

@@ -3,7 +3,6 @@
 namespace Dcat\Admin\Grid\Filter\Presenter;
 
 use Dcat\Admin\Admin;
-use Dcat\Admin\Grid\Filter;
 use Illuminate\Contracts\Support\Arrayable;
 use Illuminate\Database\Eloquent\Model;
 use Illuminate\Support\Arr;
@@ -65,13 +64,12 @@ class Select extends Presenter
     }
 
     /**
-     * 是否禁用“所有”选项
-     *
      * @return $this
      */
     public function disableSelectAll()
     {
         $this->selectAll = false;
+
         return $this;
     }
 
@@ -176,10 +174,10 @@ SCRIPT;
             'url' => $url.'?'.http_build_query($parameters),
         ];
         $configs = array_merge([
-            'allowClear'         => true,
-            'placeholder'        => [
-                'id'        => '',
-                'text'      => trans('admin.choose'),
+            'allowClear'  => true,
+            'placeholder' => [
+                'id'   => '',
+                'text' => trans('admin.choose'),
             ],
         ], $this->config);
 
@@ -267,8 +265,8 @@ JS;
     public function variables() : array
     {
         return [
-            'options' => $this->buildOptions(),
-            'class'   => $this->getElementClass(),
+            'options'   => $this->buildOptions(),
+            'class'     => $this->getElementClass(),
             'selectAll' => $this->selectAll,
         ];
     }

+ 8 - 7
src/Grid/Filter/Presenter/SelectResource.php

@@ -4,12 +4,11 @@ namespace Dcat\Admin\Grid\Filter\Presenter;
 
 use Dcat\Admin\Admin;
 use Dcat\Admin\Support\Helper;
-use Illuminate\Support\Facades\URL;
 
 class SelectResource extends Presenter
 {
     public static $js = [
-        'vendor/dcat-admin/dcat-admin/select-resource.min.js'
+        'vendor/dcat-admin/dcat-admin/select-resource.min.js',
     ];
 
     /**
@@ -38,8 +37,9 @@ class SelectResource extends Presenter
     }
 
     /**
-     * @param $width
-     * @param $height
+     * @param string $width
+     * @param string $height
+     *
      * @return $this
      */
     public function area($width, $height)
@@ -71,13 +71,13 @@ class SelectResource extends Presenter
         }
 
         $this->options = Helper::array($opts);
-
     }
 
     /**
      * Set button style.
      *
      * @param string $style
+     *
      * @return $this
      */
     public function style(string $style = 'primary')
@@ -91,6 +91,7 @@ class SelectResource extends Presenter
      * Multiple select.
      *
      * @param int|null|null $max
+     *
      * @return SelectResource
      */
     public function multiple(?int $max = null)
@@ -99,8 +100,8 @@ class SelectResource extends Presenter
     }
 
     /**
-     *
      * @param ?int $max
+     *
      * @return $this
      */
     public function max(?int $max)
@@ -138,7 +139,7 @@ class SelectResource extends Presenter
             }
         }
 
-        $this->filter->setValue(json_encode((object)$this->value));
+        $this->filter->setValue(json_encode((object) $this->value));
     }
 
     /**

+ 0 - 1
src/Grid/Filter/StartWith.php

@@ -34,5 +34,4 @@ class StartWith extends AbstractFilter
 
         return $this;
     }
-
 }

+ 2 - 2
src/Grid/Filter/Where.php

@@ -29,9 +29,9 @@ class Where extends AbstractFilter
      */
     public function __construct($column, \Closure $query, $label = '')
     {
-        $this->where  = $query;
+        $this->where = $query;
         $this->column = $column;
-        $this->label  = $this->formatLabel($label);
+        $this->label = $this->formatLabel($label);
     }
 
     /**

+ 0 - 8
src/Grid/GridAction.php

@@ -5,11 +5,9 @@ namespace Dcat\Admin\Grid;
 use Dcat\Admin\Grid;
 use Dcat\Admin\Traits\HasHtmlAttributes;
 use Illuminate\Contracts\Support\Renderable;
-use Illuminate\Http\Request;
 
 /**
  * Class GridAction.
- *
  */
 abstract class GridAction implements Renderable
 {
@@ -108,10 +106,4 @@ abstract class GridAction implements Renderable
 
         return static::$selectors[$class];
     }
-
-    protected function addScript()
-    {
-
-    }
-
 }

+ 10 - 9
src/Grid/Header.php

@@ -2,10 +2,9 @@
 
 namespace Dcat\Admin\Grid;
 
+use Dcat\Admin\Grid;
 use Dcat\Admin\Grid\Column\Help;
-use Dcat\Admin\Grid\Column\Sorter;
 use Dcat\Admin\Widgets\Widget;
-use Dcat\Admin\Grid;
 
 class Header extends Widget
 {
@@ -31,8 +30,8 @@ class Header extends Widget
 
     public function __construct(Grid $grid, string $label, array $columnNames)
     {
-        $this->grid        = $grid;
-        $this->label       = admin_trans_field($label);
+        $this->grid = $grid;
+        $this->label = admin_trans_field($label);
         $this->columnNames = $columnNames;
 
         $this->setupAttributes();
@@ -48,7 +47,7 @@ class Header extends Widget
 
     /**
      * 默认隐藏字段
-     * 开启responsive模式有效
+     * 开启responsive模式有效.
      *
      * @return $this
      */
@@ -64,7 +63,7 @@ class Header extends Widget
 
     /**
      * 允许使用responsive
-     * 开启responsive模式有效
+     * 开启responsive模式有效.
      *
      * data-priority=”1″ 保持可见,但可以在下拉列表筛选隐藏。
      * data-priority=”2″ 480px 分辨率以下可见
@@ -74,6 +73,7 @@ class Header extends Widget
      * data-priority=”6″ 1120px 以下可见
      *
      * @param int $priority
+     *
      * @return $this
      */
     public function responsive(int $priority = 1)
@@ -84,8 +84,8 @@ class Header extends Widget
     }
 
     /**
-     *
      * @param string $html
+     *
      * @return $this
      */
     public function append($html)
@@ -99,8 +99,8 @@ class Header extends Widget
      * Add a help tooltip to column header.
      *
      * @param string|\Closure $message
-     * @param null|string $style 'green', 'blue', 'red', 'purple'
-     * @param null|string $placement 'bottom', 'left', 'right', 'top'
+     * @param null|string     $style 'green', 'blue', 'red', 'purple'
+     * @param null|string     $placement 'bottom', 'left', 'right', 'top'
      *
      * @return $this
      */
@@ -112,6 +112,7 @@ class Header extends Widget
     protected function setupAttributes()
     {
         $count = count($this->columnNames);
+
         if ($count == 1) {
             $this->htmlAttributes['rowspan'] = 2;
         } else {

+ 11 - 7
src/Grid/Model.php

@@ -9,11 +9,11 @@ use Dcat\Admin\Repositories\Repository;
 use Illuminate\Database\Eloquent\Model as EloquentModel;
 use Illuminate\Database\Eloquent\Relations\Relation;
 use Illuminate\Database\Query\Builder;
+use Illuminate\Http\Request;
 use Illuminate\Pagination\AbstractPaginator;
 use Illuminate\Pagination\LengthAwarePaginator;
 use Illuminate\Support\Arr;
 use Illuminate\Support\Collection;
-use Illuminate\Http\Request;
 use Illuminate\Support\Str;
 
 /**
@@ -124,7 +124,7 @@ class Model
      * Create a new grid model instance.
      *
      * @param Repository $repository
-     * @param Request $request
+     * @param Request    $request
      */
     public function __construct(Request $request, ?Repository $repository = null)
     {
@@ -154,6 +154,7 @@ class Model
 
     /**
      * @param Collection $query
+     *
      * @return void
      */
     public function setQueries(Collection $query)
@@ -311,6 +312,7 @@ class Model
 
     /**
      * @param array $constraints
+     *
      * @return $this
      */
     public function setConstraints(array $constraints)
@@ -369,9 +371,10 @@ class Model
         ) {
             if ($isA) {
                 $data = collect($data);
-            } elseif (! empty($isP)) {
+            } elseif (!empty($isP)) {
                 $this->model = $data;
                 $this->data = $data->getCollection();
+
                 return;
             }
 
@@ -470,7 +473,7 @@ class Model
     public function getCurrentPage()
     {
         if (!$this->usePaginate) {
-            return null;
+            return;
         }
 
         return $this->currentPage ?: ($this->currentPage = ($this->request->get($this->pageName) ?: 1));
@@ -494,7 +497,7 @@ class Model
     public function getPerPage()
     {
         if (!$this->usePaginate) {
-            return null;
+            return;
         }
 
         return $this->request->get($this->perPageName) ?: $this->perPage;
@@ -636,6 +639,7 @@ class Model
 
     /**
      * @param string|array $method
+     *
      * @return void
      */
     public function rejectQueries($method)
@@ -728,7 +732,7 @@ class Model
      */
     public function reset()
     {
-        $this->data    = null;
-        $this->model   = null;
+        $this->data = null;
+        $this->model = null;
     }
 }

+ 2 - 3
src/Grid/Responsive.php

@@ -18,7 +18,7 @@ class Responsive
     /**
      * @var array
      */
-    protected $options = ['addFocusBtn' => false,];
+    protected $options = ['addFocusBtn' => false];
 
     public function __construct(Grid $grid)
     {
@@ -54,8 +54,8 @@ class Responsive
     }
 
     /**
-     * @param $key
      * @param array $options
+     *
      * @return $this
      */
     public function options(array $options)
@@ -78,5 +78,4 @@ class Responsive
             Admin::script("setTimeout(function(){ $('.table-responsive').responsiveTable($opt); },5);");
         }
     }
-
 }

+ 2 - 0
src/Grid/Row.php

@@ -72,6 +72,7 @@ class Row implements Arrayable
         ) {
             return $this->formatHtmlAttributes($attributes);
         }
+
         return '';
     }
 
@@ -147,6 +148,7 @@ class Row implements Arrayable
      *
      * @param mixed $attr
      * @param mixed $value
+     *
      * @return void
      */
     public function __set($attr, $value)

+ 0 - 1
src/Grid/Tools/BatchAction.php

@@ -102,6 +102,5 @@ abstract class BatchAction implements Renderable
         return <<<HTML
 <li><a href="#" class="{$this->getElementClass()}">{$this->getTitle()}</a></li>
 HTML;
-
     }
 }

+ 0 - 1
src/Grid/Tools/BatchDelete.php

@@ -14,7 +14,6 @@ class BatchDelete extends BatchAction
         return <<<HTML
 <li><a href="#" data-method="{$this->grid->getSelectedRowsName()}" data-action="batch-delete" data-url="{$this->resource}">{$this->title}</a></li>
 HTML;
-
     }
 
     /**

+ 3 - 3
src/Grid/Tools/CreateButton.php

@@ -19,7 +19,7 @@ class CreateButton
 
     protected function renderQuickCreateButton()
     {
-        if (! $this->grid->option('show_quick_create_btn')) {
+        if (!$this->grid->option('show_quick_create_btn')) {
             return;
         }
 
@@ -41,7 +41,7 @@ class CreateButton
 
     protected function renderCreateButton()
     {
-        if (! $this->grid->option('show_create_btn')) {
+        if (!$this->grid->option('show_create_btn')) {
             return;
         }
 
@@ -55,7 +55,7 @@ class CreateButton
 
     public function render()
     {
-        if (! $this->grid->option('show_create_btn') && ! $this->grid->option('show_quick_create_btn')) {
+        if (!$this->grid->option('show_create_btn') && ! $this->grid->option('show_quick_create_btn')) {
             return;
         }
 

+ 4 - 6
src/Grid/Tools/ExportButton.php

@@ -28,7 +28,6 @@ class ExportButton extends AbstractTool
     protected function setUpScripts()
     {
         $script = <<<JS
-
 $('.{$this->grid->getExportSelectedName()}').click(function (e) {
     e.preventDefault();
     
@@ -40,7 +39,6 @@ $('.{$this->grid->getExportSelectedName()}').click(function (e) {
     var href = $(this).attr('href').replace('__rows__', rows);
     location.href = href;
 });
-
 JS;
 
         Admin::script($script);
@@ -51,7 +49,7 @@ JS;
      */
     protected function renderExportAll()
     {
-        if (! $this->grid->getExporter()->option('show_export_all')) {
+        if (!$this->grid->getExporter()->option('show_export_all')) {
             return;
         }
         $all = trans('admin.all');
@@ -64,7 +62,7 @@ JS;
      */
     protected function renderExportCurrentPage()
     {
-        if (! $this->grid->getExporter()->option('show_export_current_page')) {
+        if (!$this->grid->getExporter()->option('show_export_current_page')) {
             return;
         }
 
@@ -80,8 +78,8 @@ JS;
     protected function renderExportSelectedRows()
     {
         if (
-            ! $this->grid->option('show_row_selector')
-            || ! $this->grid->getExporter()->option('show_export_selected_rows')
+            !$this->grid->option('show_row_selector')
+            || !$this->grid->getExporter()->option('show_export_selected_rows')
         ) {
             return;
         }

+ 3 - 2
src/Grid/Tools/QuickSearch.php

@@ -29,6 +29,7 @@ class QuickSearch extends AbstractTool
 
     /**
      * @param string|null $name
+     *
      * @return $this
      */
     public function setQueryName(?string $name)
@@ -48,6 +49,7 @@ class QuickSearch extends AbstractTool
 
     /**
      * @param int $width
+     *
      * @return $this
      */
     public function width(int $width)
@@ -108,7 +110,7 @@ class QuickSearch extends AbstractTool
 
     protected function setupScript()
     {
-        $script = <<<JS
+        $script = <<<'JS'
 var show = function () {
     var t = $(this),
         clear = t.parent().find('.quick-search-clear');
@@ -132,5 +134,4 @@ JS;
 
         Admin::script($script);
     }
-
 }

+ 13 - 15
src/Grid/Tools/Selector.php

@@ -39,18 +39,17 @@ class Selector
      */
     public function __construct(Grid $grid)
     {
-        $this->grid      = $grid;
-        $this->request   = request();
+        $this->grid = $grid;
+        $this->request = request();
         $this->selectors = new Collection();
-
         $this->queryName = $grid->getName().'_selector';
     }
 
     /**
-     * @param string $column
-     * @param string|array $label
+     * @param string         $column
+     * @param string|array   $label
      * @param array|\Closure $options
-     * @param null|\Closure $query
+     * @param null|\Closure  $query
      *
      * @return $this
      */
@@ -60,9 +59,9 @@ class Selector
     }
 
     /**
-     * @param string $column
-     * @param string $label
-     * @param array $options
+     * @param string        $column
+     * @param string        $label
+     * @param array         $options
      * @param null|\Closure $query
      *
      * @return $this
@@ -75,8 +74,8 @@ class Selector
     /**
      * @param string $column
      * @param string $label
-     * @param array $options
-     * @param null $query
+     * @param array  $options
+     * @param null   $query
      * @param string $type
      *
      * @return $this
@@ -89,7 +88,7 @@ class Selector
             }
 
             $options = $label;
-            $label   = admin_trans_field($column);
+            $label = admin_trans_field($column);
         }
 
         $this->selectors[$column] = compact(
@@ -136,8 +135,8 @@ class Selector
 
     /**
      * @param string $column
-     * @param mixed $value
-     * @param bool $add
+     * @param mixed  $value
+     * @param bool   $add
      *
      * @return string
      */
@@ -183,5 +182,4 @@ class Selector
             'selected' => $this->parseSelected(),
         ]);
     }
-
 }