Browse Source

调整Column::bool图标

jqh 5 năm trước cách đây
mục cha
commit
3781255c74
2 tập tin đã thay đổi với 17 bổ sung17 xóa
  1. 0 17
      src/Grid/Column.php
  2. 17 0
      src/Grid/Column/HasDisplayers.php

+ 0 - 17
src/Grid/Column.php

@@ -757,23 +757,6 @@ class Column
         return implode(' ', $attrArr);
     }
 
-    /**
-     * Display column as boolean , `✓` for true, and `✗` for false.
-     *
-     * @param array $map
-     * @param bool  $default
-     *
-     * @return $this
-     */
-    public function bool(array $map = [], $default = false)
-    {
-        return $this->display(function ($value) use ($map, $default) {
-            $bool = empty($map) ? boolval($value) : Arr::get($map, $value, $default);
-
-            return $bool ? '<i class="fa fa-check text-green"></i>' : '<i class="fa fa-close text-red"></i>';
-        });
-    }
-
     /**
      * Passes through all unknown calls to builtin displayer or supported displayer.
      *

+ 17 - 0
src/Grid/Column/HasDisplayers.php

@@ -277,4 +277,21 @@ trait HasDisplayers
                 ->setRow($this);
         });
     }
+
+    /**
+     * Display column as boolean , `✓` for true, and `✗` for false.
+     *
+     * @param array $map
+     * @param bool  $default
+     *
+     * @return $this
+     */
+    public function bool(array $map = [], $default = false)
+    {
+        return $this->display(function ($value) use ($map, $default) {
+            $bool = empty($map) ? $value : Arr::get($map, $value, $default);
+
+            return $bool ? '<i class="feather icon-check font-md-2 font-w-600 text-green"></i>' : '<i class="feather icon-x font-md-1 font-w-600 text-red"></i>';
+        });
+    }
 }