Using Bootstrap Error classes for flash message

Submitted by yoosuf - 3 years ago

Using of the Bootstrap Error classes for flash message, one simple helper would help to simply to extend the flash messages.


  /*
  |--------------------------------------------------------------------------
  | Styling the Error, warning and information messages
  |--------------------------------------------------------------------------
  |
  |
  |  #Usage in the controller
  |  ...->('message', Helper::notification('You have been logged in','success'));
  |
  |  #Usage in the view
  |    @if(Session::has('message'))
  |    {{Session::get('message')}}
  |  @endif
  |
  |
  */


class Helper{
    public static function notification($message,$type)
    {
         return '<div class="alert alert-'.$type.'">'.$message.'</div>';
    }
}

Ads cover the costs of maintaining Laravel-tricks

comments powered by Disqus

Ads cover the costs of maintaining Laravel-tricks