Replicate action with success redirect

This doesn't work because replica is a protected property but it needs to be set for the successRedirectUrl to evaluate it.
ReplicateAction::make()
    ->using(function ($action, Product $record): Product {
        $action->replica = $record->customRelpicate();
        return $action->replica;
    })
    ->successRedirectUrl(
        fn (Product $replica): string => ProductResource::getUrl('edit', ['record' => $replica])
    )
Was this page helpful?