Added an example with two tables in the same parent component
This commit is contained in:
30
app/Tables/DepartmentTable.php
Normal file
30
app/Tables/DepartmentTable.php
Normal 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());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user