sakanjo/laravel-flashy is a Laravel package for easy flash notifications for laravel.
It currently has 0 GitHub stars and 45 downloads on Packagist (latest version 1.1.2).
Install it with composer require sakanjo/laravel-flashy.
Discover more Laravel packages by sakanjo
or browse all Laravel packages to compare alternatives.
Last updated
A powerful package for creating flash messages in Laravel.
Require this package with composer using the following command
composer require sakanjo/laravel-flashy
Next publish the config file using the vendor:publish Artisan command
php artisan vendor:publish --provider="Flashy\ServiceProvider"
public function store(Request $request) {
User::create([
'name' => 'Salah Kanjo',
'email' => '[email protected]'
]);
Success('Successfully created');
}
public function edit(Request $request) {
Error_if(!auth()->user()->verified(), "Please verify your account first");
...
}
Or even a custom flash
Flash('info', 'Account requires verification', ['url' => 'http://example.org']);
Imagine the next senario where you have a function inside another function and you want to return an error from the inner one all the way up
public function getData() {
$user = Http::get('http://example.com/users/' . auth()->id);
Error_if($user->failed(), 'Something went wrong');
return $user;
}
public function index() {
$data = getData(); // Stops execution here if user not found
return inertia('Home', compact('data'))
}
Do you like this project? Support it by donating
Laravel flashy is developed and maintained by Salah Kanjo
Laravel flashy is open-sourced software licensed under the MIT license