Skip to content

Commit db92ba7

Browse files
authored
Merge pull request #9 from yajra/remove-column
Add method to remove column by names.
2 parents d8c106b + 8b3886d commit db92ba7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/Html/Builder.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,4 +652,21 @@ public function getColumns()
652652
{
653653
return $this->collection;
654654
}
655+
656+
/**
657+
* Remove column by name.
658+
*
659+
* @param array $names
660+
* @return $this
661+
*/
662+
public function removeColumn(...$names)
663+
{
664+
foreach ($names as $name) {
665+
$this->collection = $this->collection->filter(function (Column $column) use ($name) {
666+
return $column->name !== $name;
667+
})->flatten();
668+
}
669+
670+
return $this;
671+
}
655672
}

0 commit comments

Comments
 (0)