29 lines
683 B
PHP
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'),
|
|
);
|
|
}
|
|
|
|
} |