refactoring of admin datatables
This commit is contained in:
30
app/Datatables/Admin/Shop/SaleChannelsDataTable.php
Normal file
30
app/Datatables/Admin/Shop/SaleChannelsDataTable.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?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(['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('deliveries_count')->title('#Distrib')->searchable(false)->class('text-right'),
|
||||
Column::make('tariffs_count')->title('#Tarifs')->searchable(false)->class('text-right'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user