F
Filamentβ€’2y ago
Tin

How to redirect to edit page from create modal?

I want to redirect to edit page when I create the record in the modal. Thanks
6 Replies
LeandroFerreira
LeandroFerreiraβ€’2y ago
->after() ?
Tin
TinOPβ€’2y ago
Yeah but how to get the id. $model/$record does not resolve I can get the last record and redirect but i think there shouls be an easier way. It's late and I thought I'd ask here before investigating by myself
LeandroFerreira
LeandroFerreiraβ€’2y ago
yes, the id is the problem... maybe
public $record;

protected function getActions(): array
{
return [
Actions\CreateAction::make()
->action(function ($data) {
$this->record = Model::create($data);
})
->after(function () {
$this->mountTableAction('edit', $this->record->id);
}),
];
}
public $record;

protected function getActions(): array
{
return [
Actions\CreateAction::make()
->action(function ($data) {
$this->record = Model::create($data);
})
->after(function () {
$this->mountTableAction('edit', $this->record->id);
}),
];
}
Tin
TinOPβ€’2y ago
I guess custom solution it is then πŸ˜…
LeandroFerreira
LeandroFerreiraβ€’2y ago
yes haha.. it could be better, but you can try
Tin
TinOPβ€’2y ago
Yeah, thanks anyways πŸ™‚
Want results from more Discord servers?
Add your server