30 lines
756 B
PHP
30 lines
756 B
PHP
<?php
|
|
|
|
namespace App\Datatables\Shop;
|
|
|
|
use Yajra\DataTables\Html\Column;
|
|
use App\DataTables\ParentDataTable as DataTable;
|
|
use App\Models\Shop\ArticleAttributeFamily;
|
|
|
|
class ArticleAttributeFamiliesDataTable extends DataTable
|
|
{
|
|
public $model_name = 'ArticleAttributeFamilies';
|
|
|
|
public function query(ArticleAttributeFamily $model)
|
|
{
|
|
$model = $model::withCount(['values','articles']);
|
|
return self::buildQuery($model);
|
|
}
|
|
|
|
protected function getColumns()
|
|
{
|
|
return [
|
|
Column::make('name')->title('Nom'),
|
|
Column::make('values_count')->title('Nb attributs')->searchable(false)->addClass('text-right'),
|
|
Column::make('articles_count')->title('Nb d\'articles')->searchable(false)->addClass('text-right'),
|
|
self::makeColumnButtons(),
|
|
];
|
|
}
|
|
|
|
}
|