Laravel 5.4在视图中显示错误

I have a form where I upload a file. In the controller I do all kinds of checks on columns in this file and get some errors.

I add these errors to an array and I want to display all these errors in the view.

I tried all kinds of solution but nothing works.

Right now, I'm doing this in the controller for each line in the file:

$errors[] = array('file_name'=>$file_name, 'error'=>'Invalid coffee name');

And in the view I try these two things:

@if ($errors->any())
    {{ implode('', $errors->all('<div>:message</div>')) }}
@endif

@if ($errors->any())
 @foreach ($errors->all() as $error)
     <div>{{$error}}</div>
 @endforeach
@endif

The problem is, although I have 2 errors in the errors array (I checked), I only see the last one in the view.

What am I doing wrong?

I solved it like this:

In my controller method I added:

 $errors = new MessageBag();

When I have an error:

$errors->add('coffee', $file_name . ': Invalid coffee name');

In the view:

 @if ($errors->any())
                    <div class="alert alert-danger">
                        <p>There are errors in the file you uploaded</p>
                        <ul>
                        @foreach ($errors->all() as $error)
                            <li>{{$error}}</li>
                        @endforeach
                        </ul>
                    </div>
                @endif