refactor datatables admin

This commit is contained in:
Ludovic CANDELLIER
2023-08-29 23:31:15 +02:00
parent b1d16a7871
commit 470560efb6
37 changed files with 64 additions and 40 deletions

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Datatables\Admin\Shop;
use App\Datatables\ParentDataTable as DataTable;
use App\Models\Shop\Customer;
use Yajra\DataTables\Html\Column;
class CustomersDataTable extends DataTable
{
public $model_name = 'customers';
public function query(Customer $model)
{
$model = $model->with('addresses');
return $this->buildQuery($model);
}
protected function getColumns()
{
return [
Column::make('company')->title('Société'),
Column::make('last_name')->title('Nom'),
Column::make('first_name')->title('Prénom'),
Column::make('address')->title('Adresse'),
Column::make('zipcode')->title('Code postal'),
Column::make('city')->title('Ville'),
Column::make('phone')->title('Téléphone'),
Column::make('email')->title('Email'),
$this->makeColumnButtons(),
];
}
}