Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

codeXX's avatar

Inertia Redirect back Issue

Hi

I was caught by surprise, during development, I have returned response with back() and inertia would redirect properly. Pushing the application to production showed a different behavior. The same response result is shown in modal.

Has anyone faced the same issue? If so, how did you fix it?

0 likes
2 replies
codeXX's avatar
<Link as="button" method="DELETE"
                                    :onBefore="confirm"
                                    :href="route('app_admin.newsletter_subscribers.remove', {sub_id : s.id})"
                                    preserveScroll>Delete</Link>
public function remove(Request $request, $sub_id)
    {
        $sub = NewsletterSubscriber::findOrFail($sub_id);

        try {
            $sub->delete();
            $this->toast_success("Subscriber deleted successfully");
        } catch (Exception $e)
        {
            report($e);
            $this->toast_error("Unable to delete the subscriber at this moment, please try again later");
        }

        return back();

    }

Please or to participate in this conversation.