Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

basvandertogt's avatar

Jetstream banner without redirect

I have a custom Livewire component and want to make use of the Jetstream banner. It works but only after a redirect:

session()->flash('flash.banner', 'Yay it works!');
return redirect()->route('import');

I want it this way. But without redirect the banner is not shown:

session()->flash('flash.banner', 'Yay it works!');

Is there a way to show the banner without the redirect?

0 likes
3 replies
Tjyoung's avatar

If you want to show it on same page then you can use livewire public property for that.

Snapey's avatar

Livewire is not flashing the data to session so its not going to be found there.

You can emit to javascript from the livewire component and catch it in the window

basvandertogt's avatar
basvandertogt
OP
Best Answer
Level 2

I found out this is quit easy. Just use this inside the component:

$this->dispatchBrowserEvent('banner-message', [
    'style' => 'success',
    'message' => 'Order successfull created!'
]);
4 likes

Please or to participate in this conversation.