Extra modal actions, trigger edit modal action and open link

I have a simple resource that has view and edit screens appearing as modal, using the ->actions() method. I have added two buttons to the footer of the modal, but I can't work out how to trigger their actions. I want the “View” button to open the resources' permalink in a new tab. And I want the “Edit” button to open the EditAction modal action – the getUrl doesn't work because there is no edit page, just the modal.
Tables\Actions\ViewAction::make()
->color('info')
->modalCancelAction(false)
->extraModalFooterActions(fn (Tables\Actions\ViewAction $action): array => [
$action->makeModalAction('view')
->color('info')
->icon('heroicon-m-eye')
->url(static fn (Model $model): string => $model->permalink)
->openUrlInNewTab(),

$action->makeModalAction('edit')
->color('warning')
->icon('heroicon-m-pencil-square')
// ->url(static fn (Model $model): string => self::getUrl('edit', ['resource' => $model]))
,
]),

Tables\Actions\EditAction::make(),
Tables\Actions\ViewAction::make()
->color('info')
->modalCancelAction(false)
->extraModalFooterActions(fn (Tables\Actions\ViewAction $action): array => [
$action->makeModalAction('view')
->color('info')
->icon('heroicon-m-eye')
->url(static fn (Model $model): string => $model->permalink)
->openUrlInNewTab(),

$action->makeModalAction('edit')
->color('warning')
->icon('heroicon-m-pencil-square')
// ->url(static fn (Model $model): string => self::getUrl('edit', ['resource' => $model]))
,
]),

Tables\Actions\EditAction::make(),
2 Replies
Mark Chaney
Mark Chaney16mo ago
@trovster Does nothing happen when you click on the view action?
Jakub
Jakub2mo ago
did you ever get this working?
Want results from more Discord servers?
Add your server