Skip to content

Instantly share code, notes, and snippets.

@abanoubha
Forked from YavorK/_messages.blade.php
Created March 10, 2021 04:58
Show Gist options
  • Save abanoubha/4ff0b94bc1df04a6a52401ab236a98b6 to your computer and use it in GitHub Desktop.
Save abanoubha/4ff0b94bc1df04a6a52401ab236a98b6 to your computer and use it in GitHub Desktop.
Laravel handle-all-flash-messages partial-view
@if ($errors->any())
<div class="alert alert-danger">
@foreach ($errors->all() as $error)
{!! $error !!}<br/>
@endforeach
</div>
@endif
@if (Session::get('flash_success'))
<div class="alert alert-success">
@if(is_array(Session::get('flash_success')))
<ul>
@foreach(Session::get('flash_success') as $msg)
<li>{!! $msg !!}</li>
@endforeach
</ul>
@else
{!! Session::get('flash_success') !!}
@endif
</div>
@endif
@if (Session::get('flash_warning'))
<div class="alert alert-warning">
@if(is_array(Session::get('flash_warning')))
<ul>
@foreach(Session::get('flash_warning') as $msg)
<li>{!! $msg !!}</li>
@endforeach
</ul>
@else
{!! Session::get('flash_warning') !!}
@endif
</div>
@endif
@if (Session::get('flash_info'))
<div class="alert alert-info">
@if(is_array(Session::get('flash_info')))
<ul>
@foreach(Session::get('flash_info') as $msg)
<li>{!! $msg !!}</li>
@endforeach
</ul>
@else
{!! Session::get('flash_info') !!}
@endif
</div>
@endif
@if (Session::get('flash_danger'))
<div class="alert alert-danger">
@if(is_array(Session::get('flash_danger')))
<ul>
@foreach(Session::get('flash_danger') as $msg)
<li>{!! $msg !!}</li>
@endforeach
</ul>
@else
{!! Session::get('flash_danger') !!}
@endif
</div>
@endif
@if (Session::get('flash_message'))
<div class="alert alert-info">
@if(is_array(Session::get('flash_message')))
<ul>
@foreach(Session::get('flash_message') as $msg)
<li>{!! $msg !!}</li>
@endforeach
</ul>
@else
{!! Session::get('flash_message') !!}
@endif
</div>
@endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment