Level 50
Won't this be enough?
this.$page.props.flash.success = "Success From Front End";
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi there.
I am using Inertia.js with Laravel. Currently I can show flash messages like so below:
//HandlesInertiaRequests.php
public function share(Request $request): array
{
return array_merge(parent::share($request), [
'flash' => function () use ($request) {
return [
'success' => $request->session()->get('success'),
'error' => $request->session()->get('error'),
];
},
]);
}
<!-- AppLayout.vue -->
<main class="flex-1 overflow-y-auto">
<slot></slot>
<flash-messages></flash-messages>
</main>
<!-- FlashMessages.vue -->
<div v-show="$page.props.flash.success">{{ $page.props.flash.success }}</div>
And then lastly, I am able to trigger a flash message from a controller like so:
return redirect()->route('pipelines.index')->with('success', 'My message...');
Now, I want to be able to trigger flash messages from the frontend as well. I don't know where to start here.
Have anyone worked on a similar setup before?
Please or to participate in this conversation.