Added an example with two tables in the same parent component

This commit is contained in:
David
2025-03-31 01:19:15 -04:00
parent 69a87b3a5c
commit 63779f8bad
6 changed files with 89 additions and 5 deletions

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Tables;
use App\Models\Department;
use Illuminate\Database\Eloquent\Model;
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;
class DepartmentTable implements IGenericTable, IDragDropReordering
{
public Model|string $model = Department::class;
public ColumnCollection $columns;
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());
}
}