Laravel can only show one message by type of messages (danger, warning, success, info). There is a solution for passing many warning message (for example) :
In the controller send a tab :
$messagesSuccess = [
'test success 1',
'test success 2'
];
$messagesInfo = [
'test info 1',
'test info 2'
];
$messagesWarning = [
'test warning 1',
'test warning 2'
];
$messagesError = [
'test error 1',
'test error 2'
];
$request->session ()->flash ( 'alert-info', $messagesInfo );
$request->session ()->flash ( 'alert-success', $messagesSuccess );
$request->session ()->flash ( 'alert-warning', $messagesWarning );
$request->session ()->flash ( 'alert-danger', $messagesError );
And in the php view :
<div class="flash-message">
<ul>
@foreach (['danger', 'warning', 'success', 'info'] as $type_message)
@if(Session::has('alert-' . $type_message))
@foreach (Session::get('alert-' . $type_message) as $message)
<li><p class="alert alert-{{ $type_message }}">{{ $message }}</p></li>
@endforeach
@endif
@endforeach
</ul>
</div>
@endif <!-- end .flash-message -->
An example of the css :
.flash-message {
border-width: 0.2 em;
border-style: dashed;
border-color: grey;
}
.alert {
font-size: 1 em;
font-weight: 800;
}
.alert-danger {
color : #ff6c00;
}
.alert-warning {
color : #FFD700;
}
.alert-success {
color : green;
}
.alert-info {
color : blue;
}