Refactor table components to use GenericTableSettings and remove deprecated classes

This commit is contained in:
David
2025-04-25 01:19:30 -04:00
parent 7466083798
commit 9f12bc28d0
17 changed files with 177 additions and 203 deletions

View File

@@ -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);
}
}