From 9f12bc28d0f6e873e6947156423660f84a37123f Mon Sep 17 00:00:00 2001 From: David <75149259+TitanDvd@users.noreply.github.com> Date: Fri, 25 Apr 2025 01:19:30 -0400 Subject: [PATCH] Refactor table components to use GenericTableSettings and remove deprecated classes --- .../MyCustomSettingsTableComponent.php | 18 ------- app/Tables/DepartmentTable.php | 23 ++++---- app/Tables/Extensions/IconColumn.php | 8 ++- app/Tables/TableWithActionColumn.php | 19 ++----- app/Tables/TableWithBindedRoutes.php | 11 ++-- app/Tables/TableWithBulkActions.php | 12 ++--- app/Tables/TableWithCustomColumn.php | 24 ++++----- app/Tables/TableWithDragDropOrdering.php | 30 ++++++----- app/Tables/TableWithExport.php | 35 +++++++++--- app/Tables/TableWithFilters.php | 18 +++---- app/Tables/TableWithMySettings.php | 54 ------------------- app/Tables/TableWithPaginationSettings.php | 16 ------ app/Tables/TableWithRelationships.php | 37 ++++++++----- app/Tables/TableWithnNoSettings.php | 10 +++- app/Tables/Traits/WithColumnFormatter.php | 36 ++++++++----- .../Traits/WithExportableProductColumns.php | 13 +++-- .../with-two-tables-component.blade.php | 16 ++++-- 17 files changed, 177 insertions(+), 203 deletions(-) delete mode 100644 app/Livewire/Examples/MyCustomSettingsTableComponent.php delete mode 100644 app/Tables/TableWithMySettings.php diff --git a/app/Livewire/Examples/MyCustomSettingsTableComponent.php b/app/Livewire/Examples/MyCustomSettingsTableComponent.php deleted file mode 100644 index ace7907..0000000 --- a/app/Livewire/Examples/MyCustomSettingsTableComponent.php +++ /dev/null @@ -1,18 +0,0 @@ - TableWithMySettings::class - ]) - ->extends('components.layouts.app') - ->section('content'); - } -} diff --git a/app/Tables/DepartmentTable.php b/app/Tables/DepartmentTable.php index 8cfd5ab..c446f1b 100644 --- a/app/Tables/DepartmentTable.php +++ b/app/Tables/DepartmentTable.php @@ -2,29 +2,28 @@ namespace App\Tables; -use App\Models\Department; -use Illuminate\Database\Eloquent\Model; +use App\Models\Product; use Mmt\GenericTable\Components\Column; use Mmt\GenericTable\Components\ColumnCollection; -use Mmt\GenericTable\Enums\ColumnSettingFlags; use Mmt\GenericTable\Interfaces\IDragDropReordering; use Mmt\GenericTable\Interfaces\IGenericTable; +use Mmt\GenericTable\Support\GenericTableSettings; class DepartmentTable implements IGenericTable, IDragDropReordering { - public Model|string $model = Department::class; - - public ColumnCollection $columns; + public GenericTableSettings $tableSettings; public string $orderingColumn = 'order'; public function __construct() { - $this->columns = new ColumnCollection(); - $this->columns->add(new Column("Id")); - $this->columns->add(new Column("Name")); - $this->columns->add(new Column("Tags")); - $this->columns->add(new Column("Status")); - $this->columns->add(new Column("Order")->sortable()->defaultSortDesc()); + $columns = new ColumnCollection(); + $columns->add(new Column("Id")); + $columns->add(new Column("Name")); + $columns->add(new Column("Tags")); + $columns->add(new Column("Status")); + $columns->add(new Column("Order")->sortable()->defaultSortDesc()); + + $this->tableSettings = new GenericTableSettings(new Product(), $columns); } } \ No newline at end of file diff --git a/app/Tables/Extensions/IconColumn.php b/app/Tables/Extensions/IconColumn.php index 2e8b790..d85ad50 100644 --- a/app/Tables/Extensions/IconColumn.php +++ b/app/Tables/Extensions/IconColumn.php @@ -4,8 +4,10 @@ namespace App\Tables\Extensions; use Closure; use Mmt\GenericTable\Attributes\MappedRoute; +use Mmt\GenericTable\Interfaces\ICellData; use Mmt\GenericTable\Interfaces\IColumn; use Mmt\GenericTable\Interfaces\IColumnRenderer; +use Mmt\GenericTable\Interfaces\IRowData; use Str; class IconColumn implements IColumn, IColumnRenderer @@ -20,17 +22,19 @@ class IconColumn implements IColumn, IColumnRenderer private Closure $setIconCallback; + public int $columnIndex; + public function __construct() { if($this->databaseColumnName == null) $this->databaseColumnName = Str::snake($this->columnTitle); } - public function renderCell(\Illuminate\Database\Eloquent\Model $rowModel): string + public function renderCell(ICellData $cell, IRowData $row): string|null { $icon = 'bi bi-arrow-up-right-circle-fill'; if(isset($this->setIconCallback)) - $icon = $this->setIconCallback->call($this, $rowModel); + $icon = $this->setIconCallback->call($this, $row); return << diff --git a/app/Tables/TableWithActionColumn.php b/app/Tables/TableWithActionColumn.php index b8ef244..ad47e2c 100644 --- a/app/Tables/TableWithActionColumn.php +++ b/app/Tables/TableWithActionColumn.php @@ -3,30 +3,19 @@ namespace App\Tables; -use App\Models\Product; use App\Tables\Traits\WithExportableProductColumns; -use Illuminate\Database\Eloquent\Model; use Mmt\GenericTable\Interfaces\IActionColumn; -use Mmt\GenericTable\Interfaces\IEvent; use Mmt\GenericTable\Interfaces\IGenericTable; -use Mmt\GenericTable\Support\EventArgs; +use Mmt\GenericTable\Interfaces\IRowData; -class TableWithActionColumn implements IGenericTable, IActionColumn, IEvent +class TableWithActionColumn implements IGenericTable, IActionColumn { use WithExportableProductColumns; - public Model|string $model = Product::class; - public int $actionColumnIndex = 0; - public function actionView(Model $item): \Illuminate\View\View + public function actionView(IRowData $row): \Illuminate\View\View { - return view("tables_action_views.edit_delete_details", ['productId' => $item->id]); - } - - - public function dispatchCallback(EventArgs $arguments): void - { - + return view("tables_action_views.edit_delete_details", ['productId' => $row->get('name')]); } } \ No newline at end of file diff --git a/app/Tables/TableWithBindedRoutes.php b/app/Tables/TableWithBindedRoutes.php index 09a77fe..907ea3f 100644 --- a/app/Tables/TableWithBindedRoutes.php +++ b/app/Tables/TableWithBindedRoutes.php @@ -2,22 +2,23 @@ namespace App\Tables; -use App\Tables\Traits\WithColumnFormatter; +use App\Models\Product; use Mmt\GenericTable\Attributes\MappedRoute; use Mmt\GenericTable\Components\Column; use Mmt\GenericTable\Components\ColumnCollection; use Mmt\GenericTable\Interfaces\IDragDropReordering; use Mmt\GenericTable\Interfaces\IGenericTable; +use Mmt\GenericTable\Support\GenericTableSettings; class TableWithBindedRoutes implements IGenericTable, IDragDropReordering { - use WithColumnFormatter; + public GenericTableSettings $tableSettings; public string $orderingColumn; public function __construct() { - $this->columns = ColumnCollection::make( + $columns = ColumnCollection::make( new Column('Id'), new Column('Name'), new Column('Description') @@ -26,5 +27,9 @@ class TableWithBindedRoutes implements IGenericTable, IDragDropReordering new Column('Stock'), new Column('SubDepartment', 'subDepartment.name'), ); + + $this->tableSettings = new GenericTableSettings( + Product::class, $columns + ); } } \ No newline at end of file diff --git a/app/Tables/TableWithBulkActions.php b/app/Tables/TableWithBulkActions.php index faf1f33..7134b83 100644 --- a/app/Tables/TableWithBulkActions.php +++ b/app/Tables/TableWithBulkActions.php @@ -3,7 +3,6 @@ namespace App\Tables; use App\Models\Product; -use Illuminate\Database\Eloquent\Model; use Mmt\GenericTable\Components\Column; use Mmt\GenericTable\Components\ColumnCollection; use Mmt\GenericTable\Interfaces\IBulkAction; @@ -12,20 +11,17 @@ use Mmt\GenericTable\Support\BulkAction; use Mmt\GenericTable\Support\BulkActionCollection; use Mmt\GenericTable\Support\BulkActionGroup; use Mmt\GenericTable\Support\BulkActionSettings; +use Mmt\GenericTable\Support\GenericTableSettings; class TableWithBulkActions implements IGenericTable, IBulkAction { - public Model|string $model; - - public ColumnCollection $columns; + public GenericTableSettings $tableSettings; public BulkActionCollection $bulkActionCollection; public function __construct() { - $this->model = new Product(); - - $this->columns = ColumnCollection::make( + $columns = ColumnCollection::make( new Column('Id'), new Column('Description'), new Column('Price'), @@ -48,6 +44,8 @@ class TableWithBulkActions implements IGenericTable, IBulkAction ) ) ); + + $this->tableSettings = new GenericTableSettings(Product::class, $columns); } diff --git a/app/Tables/TableWithCustomColumn.php b/app/Tables/TableWithCustomColumn.php index 3e49ba9..e4302b2 100644 --- a/app/Tables/TableWithCustomColumn.php +++ b/app/Tables/TableWithCustomColumn.php @@ -4,35 +4,35 @@ namespace App\Tables; use App\Models\Product; use App\Tables\Extensions\IconColumn; -use Illuminate\Database\Eloquent\Model; use Mmt\GenericTable\Components\Column; use Mmt\GenericTable\Components\ColumnCollection; use Mmt\GenericTable\Interfaces\IGenericTable; +use Mmt\GenericTable\Interfaces\IRowData; +use Mmt\GenericTable\Support\GenericTableSettings; class TableWithCustomColumn implements IGenericTable { - public Model|string $model; - - public ColumnCollection $columns; + public GenericTableSettings $tableSettings; public function __construct() { - $this->model = new Product(); - $this->columns = new ColumnCollection(); - $icons = require_once('Extensions/bootstrap_icons.php'); - $this->columns->add(new Column('Id')); - $this->columns->add(new Column('Name')); - $this->columns->add(new Column('Description')); - $this->columns->add(new IconColumn()->setIconIf(function(Model $rowModel) use($icons) { + $columns = new ColumnCollection(); - if($rowModel->status == 'discontinued') { + $columns->add(new Column('Id')); + $columns->add(new Column('Name')); + $columns->add(new Column('Description')); + $columns->add(new IconColumn()->setIconIf(function(IRowData $rowModel) use($icons) { + + if($rowModel->get('status') == 'discontinued') { return $icons['bag-check'] . ' text-success'; } else { return $icons['bag-x'] . ' text-danger'; } })); + + $this->tableSettings = new GenericTableSettings(new Product(), $columns); } } \ No newline at end of file diff --git a/app/Tables/TableWithDragDropOrdering.php b/app/Tables/TableWithDragDropOrdering.php index a101ea4..96b8367 100644 --- a/app/Tables/TableWithDragDropOrdering.php +++ b/app/Tables/TableWithDragDropOrdering.php @@ -3,29 +3,29 @@ namespace App\Tables; use App\Models\Product; -use App\Tables\Traits\WithColumnFormatter; -use Illuminate\Database\Eloquent\Model; use Mmt\GenericTable\Components\Column; use Mmt\GenericTable\Components\ColumnCollection; use Mmt\GenericTable\Enums\ColumnSettingFlags; +use Mmt\GenericTable\Interfaces\IColumnFilter; use Mmt\GenericTable\Interfaces\IDragDropReordering; use Mmt\GenericTable\Interfaces\IGenericTable; -use Mmt\GenericTable\Interfaces\ISingleSelectionFilter; -use Mmt\GenericTable\Support\SelectionFilterSettings; +use Mmt\GenericTable\Support\FilterCollection; +use Mmt\GenericTable\Support\GenericTableSettings; +use Mmt\GenericTable\Support\SingleFilter; -class TableWithDragDropOrdering implements IGenericTable, IDragDropReordering, ISingleSelectionFilter +class TableWithDragDropOrdering implements IGenericTable, IDragDropReordering, IColumnFilter { - public Model|string $model = Product::class; - - public ColumnCollection $columns; + public GenericTableSettings $tableSettings; public string $orderingColumn = 'order'; - public SelectionFilterSettings $singleSelectionFilterSettings; + public FilterCollection $filters; + + public bool $useBuilder; public function __construct() { - $this->columns = ColumnCollection::make( + $columns = ColumnCollection::make( new Column('Id'), new Column('Name'), new Column('Description'), @@ -34,7 +34,13 @@ class TableWithDragDropOrdering implements IGenericTable, IDragDropReordering, I new Column('Order')->withSettings(ColumnSettingFlags::DEFAULT_SORT_DESC) ); - $this->singleSelectionFilterSettings = new SelectionFilterSettings('name'); - $this->singleSelectionFilterSettings->add('Make pop', 'ml'); + $this->tableSettings = new GenericTableSettings(Product::class, $columns); + + $this->filters = new FilterCollection( + SingleFilter::make('name', [ + 'Yes' => 'yes', + 'No' => 'No', + ]) + ); } } \ No newline at end of file diff --git a/app/Tables/TableWithExport.php b/app/Tables/TableWithExport.php index 445c6b0..53d2113 100644 --- a/app/Tables/TableWithExport.php +++ b/app/Tables/TableWithExport.php @@ -3,32 +3,55 @@ namespace App\Tables; use App\Models\Product; -use App\Tables\Traits\WithExportableProductColumns; -use Illuminate\Database\Eloquent\Model; use Illuminate\Http\Response; use Mmt\GenericTable\Attributes\CellFormatter; +use Mmt\GenericTable\Components\Cell; +use Mmt\GenericTable\Components\Column; use Mmt\GenericTable\Components\ColumnCollection; +use Mmt\GenericTable\Enums\ColumnSettingFlags; use Mmt\GenericTable\Interfaces\IExportable; use Mmt\GenericTable\Interfaces\IGenericTable; use Mmt\GenericTable\Support\ExportEventArgs; -use Mmt\GenericTable\Support\ExportSettings; +use Mmt\GenericTable\Support\GenericTableSettings; use Symfony\Component\HttpFoundation\BinaryFileResponse; class TableWithExport implements IGenericTable, IExportable { - use WithExportableProductColumns; + public GenericTableSettings $tableSettings; + + public function __construct() + { + $columns = ColumnCollection::make( + new Column('Name')->withSettings(ColumnSettingFlags::EXPORTABLE), + new Column('Description')->withSettings(ColumnSettingFlags::EXPORTABLE), + new Column('Price')->withSettings(ColumnSettingFlags::EXPORTABLE), + new Column('Stock')->withSettings(ColumnSettingFlags::EXPORTABLE) + ); + + $this->tableSettings = new GenericTableSettings( + Product::class, + $columns + ); + } public function onExport(ExportEventArgs $args) : BinaryFileResponse|Response { $args->query->take(5); $args->settings->useFormatters = true; $args->settings->fileName = 'products'; + $args->useStripTags = true; return $args->export(); } #[CellFormatter('price')] - public function priceFormatter($rowModel) + public function priceFormatter(Cell $cell) { - return '$'.$rowModel->price; + return '$'.$cell->value; + } + + #[CellFormatter('name')] + public function nameFormatter(Cell $cell) + { + return 'La ' . $cell->value; } } \ No newline at end of file diff --git a/app/Tables/TableWithFilters.php b/app/Tables/TableWithFilters.php index 769f63b..8f1f560 100644 --- a/app/Tables/TableWithFilters.php +++ b/app/Tables/TableWithFilters.php @@ -4,7 +4,6 @@ namespace App\Tables; use App\Models\Product; -use Illuminate\Database\Eloquent\Model; use Mmt\GenericTable\Components\Column; use Mmt\GenericTable\Components\ColumnCollection; use Mmt\GenericTable\Enums\CommonDateFilter; @@ -14,21 +13,18 @@ use Mmt\GenericTable\Interfaces\IDragDropReordering; use Mmt\GenericTable\Interfaces\IEvent; use Mmt\GenericTable\Interfaces\IGenericTable; use Mmt\GenericTable\Interfaces\ILoadingIndicator; -use Mmt\GenericTable\Interfaces\IMultiSelectionFilter; -use Mmt\GenericTable\Interfaces\ISingleSelectionFilter; +use Mmt\GenericTable\Interfaces\IRowData; use Mmt\GenericTable\Support\DatabaseEvent; use Mmt\GenericTable\Support\DateFilterSettings; use Mmt\GenericTable\Support\EventArgs; use Mmt\GenericTable\Support\FilterCollection; +use Mmt\GenericTable\Support\GenericTableSettings; use Mmt\GenericTable\Support\MultiFilter; -use Mmt\GenericTable\Support\SelectionFilterSettings; use Mmt\GenericTable\Support\SingleFilter; class TableWithFilters implements IGenericTable, IEvent, IDateRangeFilter, IColumnFilter, IDragDropReordering, ILoadingIndicator { - public Model|string $model = Product::class; - - public ColumnCollection $columns; + public GenericTableSettings $tableSettings; public DateFilterSettings $dateFilterSettings; @@ -44,8 +40,8 @@ class TableWithFilters implements IGenericTable, IEvent, IDateRangeFilter, IColu CommonDateFilter::LAST_3_MONTHS ); - $this->columns = ColumnCollection::make( - new Column('Id')->hookFormatter(fn($row) => '#'.$row->id), + $columns = ColumnCollection::make( + new Column('Id')->hookFormatter(fn(IRowData $row) => '#'.$row->get('id')), new Column('Order')->sortable()->defaultSort(), new Column('Name'), new Column('Price') @@ -65,6 +61,10 @@ class TableWithFilters implements IGenericTable, IEvent, IDateRangeFilter, IColu 'Client-3' => 'rem 61603388', ]) ); + + $this->tableSettings = new GenericTableSettings( + Product::class, $columns + ); } diff --git a/app/Tables/TableWithMySettings.php b/app/Tables/TableWithMySettings.php deleted file mode 100644 index b89953e..0000000 --- a/app/Tables/TableWithMySettings.php +++ /dev/null @@ -1,54 +0,0 @@ -paginationRack, PaginationRack::TOP, PaginationRack::BOTTOM); - } } \ No newline at end of file diff --git a/app/Tables/TableWithRelationships.php b/app/Tables/TableWithRelationships.php index 7e9d80c..4bbb37a 100644 --- a/app/Tables/TableWithRelationships.php +++ b/app/Tables/TableWithRelationships.php @@ -3,27 +3,40 @@ namespace App\Tables; use App\Models\Product; -use Illuminate\Database\Eloquent\Model; use Mmt\GenericTable\Components\Column; use Mmt\GenericTable\Components\ColumnCollection; +use Mmt\GenericTable\Enums\DatabaseEventQueryState; +use Mmt\GenericTable\Interfaces\IEvent; use Mmt\GenericTable\Interfaces\IGenericTable; +use Mmt\GenericTable\Support\DatabaseEvent; +use Mmt\GenericTable\Support\GenericTableSettings; -class TableWithRelationships implements IGenericTable +class TableWithRelationships implements IGenericTable, IEvent { - public Model|string $model; - - public ColumnCollection $columns; - + public GenericTableSettings $tableSettings; public function __construct() { - $this->model = new Product(); - - $this->columns = new ColumnCollection()->add( + $columns = new ColumnCollection()->add( new Column('Name'), - new Column('Department', 'subDepartment.department.name'), - new Column('SubDepartment', 'subDepartment.name'), + new Column('Department'), + new Column('SubDepartment'), ); + + $this->tableSettings = new GenericTableSettings(new Product(), $columns, true); + } + public function dispatchCallback(\Mmt\GenericTable\Support\EventArgs $arguments): void + { + if($arguments instanceof DatabaseEvent) { + if($arguments->queryState == DatabaseEventQueryState::INITIALIZING) { + $arguments->builder->join('sub_departments', 'sub_departments.id', 'products.sub_department_id') + ->join('departments', 'departments.id', 'sub_departments.department_id') + ->select( + 'products.name as name', + 'departments.name as department', + 'sub_departments.name as sub_department' + ); + } + } } - } \ No newline at end of file diff --git a/app/Tables/TableWithnNoSettings.php b/app/Tables/TableWithnNoSettings.php index ad4bf8f..5cc6239 100644 --- a/app/Tables/TableWithnNoSettings.php +++ b/app/Tables/TableWithnNoSettings.php @@ -6,10 +6,16 @@ use App\Models\Product; use Illuminate\Database\Eloquent\Model; use Mmt\GenericTable\Components\ColumnCollection; use Mmt\GenericTable\Interfaces\IGenericTable; +use Mmt\GenericTable\Support\GenericTableSettings; class TableWithnNoSettings implements IGenericTable { - public Model|string $model = Product::class; + public GenericTableSettings $tableSettings; - public ColumnCollection $columns; + public function __construct() + { + $this->tableSettings = new GenericTableSettings( + Product::class + ); + } } \ No newline at end of file diff --git a/app/Tables/Traits/WithColumnFormatter.php b/app/Tables/Traits/WithColumnFormatter.php index 574cc49..7f33fc2 100644 --- a/app/Tables/Traits/WithColumnFormatter.php +++ b/app/Tables/Traits/WithColumnFormatter.php @@ -3,48 +3,56 @@ namespace App\Tables\Traits; use App\Models\Product; -use Illuminate\Database\Eloquent\Model; use Mmt\GenericTable\Attributes\CellFormatter; -use Mmt\GenericTable\Attributes\MappedColumn; use Mmt\GenericTable\Components\Column; use Mmt\GenericTable\Components\ColumnCollection; -use Mmt\GenericTable\Enums\ColumnSettingFlags; +use Mmt\GenericTable\Enums\PaginationRack; +use Mmt\GenericTable\Interfaces\ICellData; +use Mmt\GenericTable\Interfaces\IRowData; +use Mmt\GenericTable\Support\GenericTableSettings; trait WithColumnFormatter { - public Model|string $model = Product::class; + public GenericTableSettings $tableSettings; - public ColumnCollection $columns; + public int $paginationRack = 0; + + public int $rowsPerPage = 10; + public array $rowsPerPageOptions = [10,20,40,60,80]; public function __construct() { - $this->columns = ColumnCollection::make( + $columns = ColumnCollection::make( new Column('Id'), new Column('Name'), new Column('Description'), new Column('Price'), new Column('Stock'), new Column('SubDepartment', 'subDepartment.name'), - new Column('Empty Column')->withSettings(ColumnSettingFlags::EMPTY), - new Column('Empty Hook')->withSettings(ColumnSettingFlags::EMPTY)->hookFormatter(fn($rowModel) => $this->emptyCol($rowModel)), + new Column('Empty Column')->empty(), + new Column('Empty Hook')->empty()->hookFormatter(fn(IRowData $row) => $this->emptyCol($row)), ); + + $this->tableSettings = new GenericTableSettings(Product::class, $columns); + + PaginationRack::addFlags($this->paginationRack, PaginationRack::TOP, PaginationRack::BOTTOM); } - public function emptyCol($model) + public function emptyCol(IRowData $row) { - return ''.$model->id.''; + return ''.$row->get('id').''; } #[CellFormatter('price')] - public function priceFormatter(Model $modelItem) + public function priceFormatter(ICellData $cell, IRowData $row) { - return "\$ {$modelItem->price}"; + return "\$ {$cell->value}"; } #[CellFormatter('id')] - public function idFormatter(Model $modelItem) + public function idFormatter(ICellData $cell, IRowData $row) { - return '# '.$modelItem->id; + return '# '.$cell->value; } } \ No newline at end of file diff --git a/app/Tables/Traits/WithExportableProductColumns.php b/app/Tables/Traits/WithExportableProductColumns.php index 7ae22ad..c79550c 100644 --- a/app/Tables/Traits/WithExportableProductColumns.php +++ b/app/Tables/Traits/WithExportableProductColumns.php @@ -3,24 +3,27 @@ namespace App\Tables\Traits; use App\Models\Product; -use Illuminate\Database\Eloquent\Model; use Mmt\GenericTable\Components\Column; use Mmt\GenericTable\Components\ColumnCollection; use Mmt\GenericTable\Enums\ColumnSettingFlags; +use Mmt\GenericTable\Support\GenericTableSettings; trait WithExportableProductColumns { - public Model|string $model = Product::class; - - public ColumnCollection $columns; + public GenericTableSettings $tableSettings; public function __construct() { - $this->columns = ColumnCollection::make( + $columns = ColumnCollection::make( new Column('Name')->withSettings(ColumnSettingFlags::EXPORTABLE), new Column('Description')->withSettings(ColumnSettingFlags::EXPORTABLE), new Column('Price')->withSettings(ColumnSettingFlags::EXPORTABLE), new Column('Stock')->withSettings(ColumnSettingFlags::EXPORTABLE) ); + + $this->tableSettings = new GenericTableSettings( + Product::class, + $columns + ); } } \ No newline at end of file diff --git a/resources/views/livewire/examples/with-two-tables-component.blade.php b/resources/views/livewire/examples/with-two-tables-component.blade.php index 2a2afd0..d80429f 100644 --- a/resources/views/livewire/examples/with-two-tables-component.blade.php +++ b/resources/views/livewire/examples/with-two-tables-component.blade.php @@ -1,11 +1,19 @@