fixes on invoices relations and revisions
This commit is contained in:
@@ -13,6 +13,7 @@ class InvoicesDataTable extends DataTable
|
||||
|
||||
public function query(Invoice $model)
|
||||
{
|
||||
$model = $model->with('customer');
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
@@ -26,7 +27,7 @@ class InvoicesDataTable extends DataTable
|
||||
return $invoice->created_at->toDateTimeString();
|
||||
})
|
||||
->editColumn('customer.last_name', function (Invoice $invoice) {
|
||||
return $invoice->customer->last_name . ' ' . $invoice->customer->first_name;
|
||||
return ($invoice->customer ?? false) ? $invoice->customer->last_name . ' ' . $invoice->customer->first_name : '';
|
||||
})
|
||||
->rawColumns(['action']);
|
||||
return parent::modifier($datatables);
|
||||
@@ -38,7 +39,7 @@ class InvoicesDataTable extends DataTable
|
||||
|
||||
Column::make('status'),
|
||||
Column::make('created_at')->title('Date'),
|
||||
Column::make('customer.last_name'),
|
||||
Column::make('customer.last_name')->default(''),
|
||||
Column::make('total'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user