One solution would be to flash two variables into the session:
- The message itself
- The “class” of your alert
for example:
Session::flash('message', 'This is a message!');
Session::flash('alert-class', 'alert-danger');
Then in your view:
@if(Session::has('message'))
<p class="alert {{ Session::get('alert-class', 'alert-info') }}">{{ Session::get('message') }}</p>
@endif
Note I’ve put a default value into the Session::get(). that way you only need to override it if the warning should be something other than the alert-info class.
(that is a quick example, and untested 🙂 )