feat(expense): add created_at column to expenses table and include WithAppendColumn trait
This commit is contained in:
parent
ba616954cb
commit
6f7737ec79
@ -3,6 +3,7 @@
|
||||
namespace App\Livewire\Datatable\Studio\Finance;
|
||||
|
||||
use App\Models\Expense;
|
||||
use App\Traits\Datatable\WithAppendColumn;
|
||||
use App\Traits\Datatable\WithConfiguration;
|
||||
use App\Traits\Datatable\WithPrependColumn;
|
||||
use App\Traits\WithMediaHandler;
|
||||
@ -12,7 +13,7 @@
|
||||
|
||||
class ExpensesTable extends DataTableComponent
|
||||
{
|
||||
use WithConfiguration, WithMediaHandler, WithPrependColumn;
|
||||
use WithAppendColumn, WithConfiguration, WithMediaHandler, WithPrependColumn;
|
||||
|
||||
protected $model = Expense::class;
|
||||
|
||||
@ -28,6 +29,10 @@ public function columns(): array
|
||||
Column::make('Outlet', 'outlet.name')
|
||||
->searchable(),
|
||||
|
||||
Column::make('Tanggal', 'created_at')
|
||||
->format(fn ($value) => formatDateTime($value))
|
||||
->searchable(),
|
||||
|
||||
Column::make('Aksi')
|
||||
->label(function ($row) {
|
||||
$actions = '';
|
||||
@ -55,6 +60,6 @@ public function columns(): array
|
||||
|
||||
public function builder(): Builder
|
||||
{
|
||||
return Expense::select('expenses.id', 'description', 'amount')->with('outlet');
|
||||
return Expense::select('expenses.id', 'description', 'amount', 'expenses.created_at')->with('outlet');
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user