Laraflash
Laraflash copied to clipboard
Laraflash streamlines the process of displaying temporary messages in your Laravel application. Its focus on simplicity and performance makes it an ideal choice for projects of all sizes
Laraflash
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