0👍
Why you are not using inertia inbuilt feature
class HandleInertiaRequests extends Middleware
{
public function share(Request $request)
{
return array_merge(parent::share($request), [
'flash' => [
'message' => fn () => $request->session()->get('message'),
'otherWhareverMessage => ".......",
],
]);
}
}
And in front-end
<div v-if="$page.props.flash.message" class="alert">
{{ $page.props.flash.message }}
</div>
Source:stackexchange.com