Files
generic_table_examples/app/Tables/TableWithRelationships.php
2025-03-12 00:41:31 -04:00

29 lines
683 B
PHP

<?php
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\IGenericTable;
class TableWithRelationships implements IGenericTable
{
public Model|string $model;
public ColumnCollection $columns;
public function __construct()
{
$this->model = new Product();
$this->columns = new ColumnCollection()->add(
new Column('Name'),
new Column('Department', 'subDepartment.department.name'),
new Column('SubDepartment', 'subDepartment.name'),
);
}
}