binkap/laraflash

Flash messages for Laravel and Livewire

Fund package maintenance!
binkapS

Installs: 83

Dependents: 0

Suggesters: 0

Security: 0

Stars: 18

Watchers: 2

Forks: 1

Language:Blade

2.0.0 2024-04-22 22:24 UTC

This package is auto-updated.

Last update: 2024-11-15 09:02:57 UTC


README

Flash Session messages for Laravel and Livewire

Total Installs Latest Stable Version Software License

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

DarkMode flash

LightMode

LightMode flash

See CHANGELOG for Changes