Files
opensem/app/DataTables/Shop/ArticleAttributeFamiliesDataTable.php
Ludovic CANDELLIER 5536393318 Fix typo
2021-04-02 15:59:03 +02:00

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(),
];
}
}