Last active
August 7, 2024 21:30
-
-
Save YavorK/7aa6e839dbe93e8854e4b033e31836a4 to your computer and use it in GitHub Desktop.
Laravel handle-all-flash-messages partial-view
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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
Thats so bad