I've followed several examples on this, including the laracasts video on flash messaging, but for whatever reason, I can never get the data passed to load into the props. Here's what I have:
In HandleInertiaRequests.php:
'flash' => function () use ($request) {
return [
'success' => $request->session()->get('success'),
'error' => $request->session()->get('error'),
];
From a controller:
...
$page->save();
return redirect('/admin/pages')->with('success', 'Page created successfully');
And when I save a page, I check the vue dev tools and find this:
I also find it interesting that when the page is given a full page reload on a route that has with(...) data, that data populates a prop with the name passed to with, but even that doesn't allow the middleware to fill the flash props, and it (strangely) creates a new prop at 'page.props.success', with 'page.props.flash.success' still remaining null.