F
Filament6mo ago
ashar

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
5 Replies
Wbzy
Wbzy6mo ago
try (new SessionService)->addGame($this->session, $data);
ashar
ashar6mo ago
->action((new SessionService))->addGame($this->session,$data); like this ? @Wbzy i have modified it like this 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); }); } still action not performing
Wbzy
Wbzy6mo ago
public function endGame()
{
return Action::make('End')
->icon('heroicon-m-no-symbol')
->color('danger')
->action(function (array $data): void {
(new SessionService)->addGame($this->session, $data);
});
}
public function endGame()
{
return Action::make('End')
->icon('heroicon-m-no-symbol')
->color('danger')
->action(function (array $data): void {
(new SessionService)->addGame($this->session, $data);
});
}
like this
ashar
ashar6mo ago
didnt work @Wbzy this is a custom page @Wbzy ok i found the erroe function name is end game and Action is ENd ..Name should be same . It works now Thanks for your assistance too @Wbzy
Wbzy
Wbzy6mo ago
good to hear