Add new version in repository
This commit is contained in:
38
app/Datatables/Shop/PriceListsDataTable.php
Normal file
38
app/Datatables/Shop/PriceListsDataTable.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\PriceList;
|
||||
|
||||
class PriceListsDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'price_lists';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = route('Admin.Shop.PriceLists.index');
|
||||
}
|
||||
|
||||
public function query(PriceList $model)
|
||||
{
|
||||
$model = self::filterByTariff($model);
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
public static function filterByTariff($model, $tariff_id = false)
|
||||
{
|
||||
$tariff_id = $tariff_id ? $tariff_id : self::isFilteredByField('tariff_id');
|
||||
return $tariff_id ? $model->byTariff($tariff_id) : $model;
|
||||
}
|
||||
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name')->title('Nom'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user