Laravel

Livewire Redirect After Action

January 16, 2026 1 min read 26 views

Redirect after actions:

Basic Redirect

public function save()
{
    Post::create($this->data);
    return redirect()->route('posts.index');
}

With Flash Message

public function save()
{
    Post::create($this->data);
    session()->flash('success', 'Post created!');
    return redirect()->route('posts.index');
}

Navigate Without Refresh

public function save()
{
    Post::create($this->data);
    return $this->redirect('/posts', navigate: true);
}

Redirect to Component

return $this->redirectRoute('posts.show', ['post' => $post]);
Share this post:

Related Posts

Comments (0)

Please log in to leave a comment. Log in

No comments yet. Be the first to comment!