28 lines
655 B
PHP
28 lines
655 B
PHP
<?php
|
|
|
|
namespace App\Datatables\Shop;
|
|
|
|
use Yajra\DataTables\Html\Column;
|
|
use App\Datatables\ParentDataTable as DataTable;
|
|
use App\Models\Shop\Category;
|
|
|
|
class CategoriesDataTable extends DataTable
|
|
{
|
|
public $model_name = 'categories';
|
|
|
|
public function query(Category $model)
|
|
{
|
|
$model = $model::withCount('articles');
|
|
return self::buildQuery($model);
|
|
}
|
|
|
|
protected function getColumns()
|
|
{
|
|
return [
|
|
Column::make('name')->title('Nom'),
|
|
Column::make('articles_count')->title('Nb Articles')->class('text-right')->searchable(false),
|
|
self::makeColumnButtons(),
|
|
];
|
|
}
|
|
}
|