Files
opensem/app/Datatables/Admin/Shop/SaleChannelsDataTable.php
2023-12-09 21:02:28 +01:00

32 lines
977 B
PHP

<?php
namespace App\Datatables\Admin\Shop;
use App\Datatables\ParentDataTable as DataTable;
use App\Models\Shop\SaleChannel;
use Yajra\DataTables\Html\Column;
class SaleChannelsDataTable extends DataTable
{
public $model_name = 'sale_channels';
public function query(SaleChannel $model)
{
$model = $model->withCount(['customers', 'deliveries', 'tariffs']);
return $this->buildQuery($model);
}
protected function getColumns()
{
return [
Column::make('code')->title('Code abrégé')->width(100),
Column::make('name')->title('Nom'),
Column::make('customers_count')->title('#Clients')->searchable(false)->class('text-right'),
Column::make('deliveries_count')->title('#Distrib')->searchable(false)->class('text-right'),
Column::make('tariffs_count')->title('#Tarifs')->searchable(false)->class('text-right'),
$this->makeColumnButtons(),
];
}
}