Skip to main content
Back to packages
668 GitHub stars

spatie/laravel-flash

View on GitHub

Description

This is a lightweight package to send flash messages in Laravel apps. A flash message is a message that is carried over to the next request by storing it in the session. This package only supports one single flash message at a time.

This is how it can be used:

class MySpecialSnowflakeController
{
public function store()
{
//
 
flash('My message', 'my-class');
 
return back();
}
}

In your view you can do this:

@if (flash()->message)
<div class="{{ flash()->class }}">
{{ flash()->message }}
</div>
@endif

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.