<?php

namespace App\Datatables\Shop;

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

class ArticleNaturesDataTable extends DataTable
{
    public $model_name = 'article_natures';

    public function query(ArticleNature $model)
    {
        $model = $model::withCount('Articles');
        return $this->buildQuery($model);
    }

    protected function getColumns()
    {
        return [
            Column::make('name')->title('Nom'),
            Column::make('articles_count')->title('#Art')->addClass('text-right')->searchable(false)->width(60),
            $this->makeColumnButtons(),
        ];
    }
}
