F
Filament12mo 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
Wbzy12mo ago
try (new SessionService)->addGame($this->session, $data);
ashar
asharOP12mo 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
Wbzy12mo 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
asharOP12mo 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
Wbzy12mo ago
good to hear
Want results from more Discord servers?
Add your server