Browse Source

Grid\Column::if 允许参数留空

jqh 4 năm trước cách đây
mục cha
commit
540013574b
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      src/Grid/Column.php

+ 5 - 1
src/Grid/Column.php

@@ -280,8 +280,12 @@ class Column
      *
      * @return Column\Condition
      */
-    public function if(\Closure $condition)
+    public function if(\Closure $condition = null)
     {
+        $condition = $condition ?: function ($column) {
+            return $column->getValue();
+        };
+
         return $this->conditions[] = new Grid\Column\Condition($condition, $this);
     }