Livewire Flash Message package

For those interested in a Flash Message solution that is usable in a similar way to laracasts/flash, I’ve created a spinoff here: https://github.com/mattlibera/livewire-flash

It uses TailwindCSS and FontAwesome for icons out of the box but is entirely configurable/customizable.

The basic gist is that you can append ->livewire($this) when calling the flash() directive from within your Livewire components, and this will take care of emitting the message to the container component for immediate display. Or, omit the livewire() part to flash it to the session and it will show up on next page load.

I’m sure it’s not the only solution, but this helped me to pretty easily merge Livewire functionality with the “traditional” functionality provided by the Laracasts package.

I also added goodies in there like the ability to create your own custom message types beyond the “standard” info, warning, etc.

Hope this is helpful to at least someone out there!

2 Likes

Nice work @mattlibera, I will Try soon and gives you feedback

1 Like

@mattlibera Great Job!!!

1 Like

Is it possible to dismiss the flash message from the live wire component on say the updated hook?

Hi @finchy70,

The dismiss() method on the individual FlashMessage component should be callable publicly, so you should be able to work that into your code really anywhere… especially with the fact that Livewire directives can be called via Javascript too…

Hope that helps.