32 lines
977 B
PHP
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(),
|
|
];
|
|
}
|
|
}
|