<?php

namespace App\Datatables\Admin\Shop;

use App\Datatables\ParentDataTable as DataTable;
use App\Models\Shop\PriceGenericCategory;
use Yajra\DataTables\Html\Column;

class PriceGenericCategoriesDataTable extends DataTable
{
    public $model_name = 'price_generic_categories';

    public function query(PriceGenericCategory $model)
    {
        $model = $model->withCount('price_generics');

        return $this->buildQuery($model);
    }

    protected function getColumns()
    {
        return [
            Column::make('name')->title('Nom'),
            Column::make('price_generics_count')->title('Nb Tarifs')->class('text-right'),
            $this->makeColumnButtons(),
        ];
    }
}
