1. Go to this page and download the library: Download hampel/alerts library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$mybag = new MesageBag();
// add messages to your messagebag
// now get the alert message bag
$alerts = Alert::getMessageBag();
// merge in our messages
$alerts->merge($mybag);
// flash the messages to the session
Alert::flash();
// flash the messages to the session - this is the easiest way to do it
Alert::success('Operation succeeded')->flash();
// alternatively, return a redirect response and let Laravel flash the messages
return Redirect::to('myroute')->with(Alert::getSessionKey(), Alert::error('There was a problem')->getMessageBag()->getMessages());
// you can always just do it all manually and not use the AlertManager at all!
$messages = new MessageBag;
$messages->add('info', Lang::get('something.happened.info'));
Session::flash(Config::get('alerts::session_key', $messages->getMessages());