This feature enables you to easily define and display flash messages
for your application.
The flash()
helper which actually calls the App\Helpers\FlashHelper
class behind the scenes, is developed around Laravel's SessionManager
, meaning it uses the flashed sessions
to get the message and display it.
Set a success
message to be flashed
on the next request.
flash()->success('Your success message!');
Display the success
message.
{!! flash()->success() !!}
Set an error
message to be flashed
on the next request.
flash()->error('Your error message!');
Display the error
message.
{!! flash()->error() !!}
Set a warning
message to be flashed
on the next request.
flash()->warning('Your warning message!');
Display the warning
message.
{!! flash()->warning() !!}
Display
any (the correct
) flash message
inside your view file
.
{!! flash()->message() !!}
// or
{!! flash('admin')->message() !!}
The
flash()
helper receives one parameter (type), which is by default instantiated to thedefault
value.This parameter tells the
flash()
helper which view to render.
For the moment, onlydefault
andadmin
are supported as types.
You can find their front-end implementation insideresources/helpers/flash/message
directory.Additionally you can define your own types by creating a view with the
name of the type
inside theresources/helpers/flash/message
directory.