32 lines
828 B
PHP
32 lines
828 B
PHP
<?php
|
|
|
|
namespace App\DataTables\Shop;
|
|
|
|
use Yajra\DataTables\Html\Column;
|
|
use App\DataTables\ParentDataTable as DataTable;
|
|
use App\Models\Shop\PriceGeneric;
|
|
|
|
class PriceGenericsDataTable extends DataTable
|
|
{
|
|
public $model_name = 'price-generics';
|
|
|
|
public function query(PriceGeneric $model)
|
|
{
|
|
$model = $model::with(['category','priceByUnit'])->withCount('prices');
|
|
return self::buildQuery($model);
|
|
}
|
|
|
|
protected function getColumns()
|
|
{
|
|
return [
|
|
Column::make('category.name')->title('Catégorie'),
|
|
Column::make('name')->title('Nom'),
|
|
Column::make('price_by_unit.price')->title('Prix HT')->class('text-right'),
|
|
Column::make('price_by_unit.price_taxed')->title('Prix TTC')->class('text-right'),
|
|
Column::make('prices_count')->title('Nb tarifs')->class('text-right'),
|
|
self::makeColumnButtons(),
|
|
];
|
|
}
|
|
|
|
}
|