-
Notifications
You must be signed in to change notification settings - Fork 105
errors.blade.php may fail if there is no errors array #6
Copy link
Copy link
Open
Description
I discovered that when there is only one error in error array, then error.blade.php code may fail to run.
Suggestion to improve the code is added below:
@if (isset($errors))
@if(is_array($errors))
@if( count($errors) > 0)
<div class="alert alert-dismissable alert-danger fade show">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
@foreach($errors->all() as $error)
<li class="list-unstyled"><strong>{!! $error !!}</strong></li>
@endforeach
</div>
@endif
@else
<div class="alert alert-dismissable alert-danger fade show">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<li class="list-unstyled"><strong>{{$errors}}</strong></li>
</div>
@endif
@endif
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels