summaryrefslogtreecommitdiff
path: root/src/TableComponent.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/TableComponent.php')
-rw-r--r--src/TableComponent.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/TableComponent.php b/src/TableComponent.php
index 04d457e..da31a90 100644
--- a/src/TableComponent.php
+++ b/src/TableComponent.php
@@ -4,6 +4,7 @@ namespace Lightscale\LaralightTables;
use Livewire\Component;
use Livewire\WithPagination;
+use Livewire\Attributes\Url;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Str;
@@ -28,6 +29,8 @@ abstract class TableComponent extends Component
// Properties
public string $search = '';
+
+ #[Url]
public int $pageSize = 0;
public array $activeColumns = [];
@@ -72,17 +75,17 @@ abstract class TableComponent extends Component
return $query;
}
+ private $columnsCache = null;
+
protected function getColumns()
{
- static $columns = null;
-
- if($columns === null) {
- $columns = collect($this->columns())->each(
+ if($this->columnsCache === null) {
+ $this->columnsCache = collect($this->columns())->each(
fn($c) => $c->setTable($this)
);
}
- return $columns;
+ return $this->columnsCache;
}
public function render()