Skip to main content

Flash Success Messages in Inertia

Premium
2 min read

Let's show some success messages when submitting the form.

It is very common to show some success message when redirecting back.

app/Http/Controllers/PostController.php:

class PostController extends Controller
{
// ...
 
public function store(StorePostRequest $request): RedirectResponse
{
Post::create($request->validated());
 
return redirect()->route('posts.index')
->with('message', 'Post created successfully.');
}
}

But how do we catch this message in Inertia? We must pass that variable as...

The Full Lesson is Only for Premium Members

Want to access all of our courses? (31 h 16 min)

You also get:

55 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Comments & Discussion

No comments yet…