ashar
passing dynamic data
i hace a booking resource in which i am calling a component.
public \App\Models\Session $session;
public function __construct(BookingService $bookingService)
{
$this->bookingService = $bookingService;
}
public function mount($session): void
{
$this->session = $session;
}
component action
->actions([
Action::make('viewItems')->view('filament.actions.view-items', [
'sessionId' => 1,
'style' => 'link',
])->hidden(
fn($record) => (!$record->isActive() $record->isCancelled() $record->isCompleted())
),
how can i pass this sessionId dynamic ?? right now its static
7 replies
adding input in component
This is a component .
public function table(Table $table): Table
{
return $table
->query(function (VoucherService $voucherService) {
return ($voucherService->sessionVoucherQuery($this->record->id));
})
->columns([
Tables\Columns\TextColumn::make('name')->label('Name'),
Tables\Columns\TextColumn::make('voucherable.gameTable.name')->label('Table Name'),
Tables\Columns\TextColumn::make('voucherable.gameTable.type')->label('Table Type'),
Tables\Columns\TextColumn::make('voucherable.sub_total')->label('Sub Total'),
Tables\Columns\TextColumn::make('voucherable.overtime_amount')->label('Overtime'),
Tables\Columns\TextColumn::make('voucherable.quantity')->label('Quantity'),
Tables\Columns\TextColumn::make('voucherable.total')->label('Total'),
Tables\Columns\TextColumn::make('voucher.total')->label('Total'),
])
->filters([
//
])
->actions([
Button::make('View')->click(fn ($model) => $this->viewAction($model)),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
//
]),
]);
}
public function render(): View
{
return view('livewire.session-billing-view');
}
}
can i add here a input field where i will calculate the total . Just need to render a field . unable to do it .
2 replies
action not working
public function endGame()
{
return Action::make('End')
->icon('heroicon-m-no-symbol')
->color('danger')
->action(function (array $data, SessionService $sessionService): void {
$sessionService->addGame($this->session, $data);
});
}
public function addGame(Session $session, array $data): Model
{
dd(123);
$data['start_time'] = Carbon::now()->toDateTimeString();
$this->endOngoingGame($session, GameTable::find($data['game_table_id']));
return $session->sessionGames()->create($data);
}
not coming in function . if it comes it should show dump 123
13 replies
hi,
i have two fields
Forms\Components\Select::make('account_id')->options((new ExpenseService())->getAccounts())->placeholder('Please select a debit account'),
Forms\Components\Hidden::make('name')->default(), how can i use llive() on account so what ever the account is, the name defuault column gets updated with it
Forms\Components\Hidden::make('name')->default(), how can i use llive() on account so what ever the account is, the name defuault column gets updated with it
15 replies