binkap / laraflash
Flash messages for Laravel and Livewire
Fund package maintenance!
binkapS
2.0.0
2024-04-22 22:24 UTC
Requires
- php: ^8.1
This package is auto-updated.
Last update: 2024-12-15 09:06:30 UTC
README
Flash Session messages for Laravel and Livewire
Installation
composer require binkap/laraflash
Add the flash container to your layout
<x-laraflash::container />
Laraflash currently uses Tailwind CSS
export default { content: [ "./vendor/binkap/laraflash/src/views/**/*.blade.php", ], }
Flashing messages
Choose the method most convenient for you.
1: Helper Functions
use function Binkap\Laraflash\flash; flash()->message('Message sent successfully') ->success() // Optional (Uses default when not specified) ->livewire($component); /* Call the livewire method to flash the message with livewire */
Or
use function Binkap\Laraflash\alert; alert()->message('Message sent successfully') ->success() // Optional (Uses default when not specified) ->livewire($component); /* Call the livewire method to flash the message with livewire */
2: Facade
use Binkap\Laraflash\Laraflash; Laraflash::message('Provide a valid message') ->warning() ->livewire($component); /* Call the livewire method to flash the message with livewire */
All methods
// MODE methods $flash->success() // For success $flash->warning() // For warnings $flash->danger() // For errors
Rendered messages
Here are example of rendered messages
DarkMode
LightMode
See CHANGELOG for Changes