From 32488b0749831ab17a573214cfae7818a0b2c907 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 27 Jul 2021 17:41:09 +0100 Subject: [PATCH] Make displaying columns optional --- php/InertiaTable.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/php/InertiaTable.php b/php/InertiaTable.php index 9ca55fe..00ab094 100644 --- a/php/InertiaTable.php +++ b/php/InertiaTable.php @@ -161,14 +161,15 @@ public function applyTo(Response $response): Response * * @param string $key * @param string $label + * @param bool $enabled * @return self */ - public function addColumn(string $key, string $label): self + public function addColumn(string $key, string $label, bool $enabled = true): self { $this->columns->put($key, [ 'key' => $key, 'label' => $label, - 'enabled' => true, + 'enabled' => $enabled, ]); return $this; @@ -177,7 +178,7 @@ public function addColumn(string $key, string $label): self public function addColumns(array $columns = []): self { foreach ($columns as $key => $value) { - $this->addColumn($key, $value); + $this->addColumn($key, $value, true); } return $this;