Courses

Vue Inertia + Laravel 11: From Scratch

Flash Success Messages in Inertia

Summary of this lesson:
- Adding success messages after form submission
- Implementing shared data through middleware
- Managing flash messages in layouts
- Displaying temporary notifications

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 18 lessons of this course? (56 min read)

You also get:

  • 69 courses (majority in latest Laravel 11)
  • Premium tutorials
  • Access to repositories
  • Private Discord