Skip to main content
Back to packages
669 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

Recent Courses on Laravel Daily