我是Laravel的新手。我试图在我的视图中显示错误,但我收到错误:
ErrorException,带有消息' isset中的非法偏移类型或为空
这是我的错误逻辑:
@foreach(['success' => 'check', 'info' => 'exclamation-circle', 'warning' => 'warning', 'danger' => 'ban'] as $type => $icon )
@if (Session::has($type))
<div class="alert alert-{{ $type }} fade in">
<a href="#" class="close" data-dismiss="alert"></a>
<i class="fa fa-{{ $icon }}"></i> {{ Session::get( $type ) }}
</div>
@endif
@endforeach
@if (count($errors) > 0)
@foreach ($errors->all() as $index => $message)
<div class="alert alert-danger fade in">
<a href="#" class="close" data-dismiss="alert">×</a>
<i class="fa fa-times"></i> {{ $message }}
</div>
@endforeach
@endif
我做错了什么?