Hi, could you try as in the documentation
'flash' => [
'success' => fn() => $request->session()->get('success')
]
Hello everyone, how are you? I'm using Laravel 11 + Vue.js + Inertia.js and facing the simple and strange issue related flash session. In Laravel controller, I am redirecting to other route and used 'with' method to send flash message. And tried to get flash session value in 'HandleInertiaRequests' middleware. But I can't get flash session value, it doesn't persist when redirecting. How to resolve the this issue?
Let me share code snippet
ListingController.php
return redirect()
->route('listing.index')
->with('success', 'Listing was created!');
HandleInertiaRequests.php
return array_merge(parent::share($request), [
'flash' => [
'success' => $request->session()->get('success')
]
]);
Please or to participate in this conversation.