当我访问我的 Laravel 项目时。它返回以下错误。如何解决它。
Missing argument 1 for Illuminate\Support\MessageBag::has(), called in /var/www/laravel/vendor/laravel/framework/src/Illuminate/Support/ViewErrorBag.php on line 92 and defined (View: /var/www/laravel/resources/views/welcome.blade.php)
在我的刀片代码中:
@if ($errors->has())
<div class="alert alert-danger">
@foreach ($errors->all() as $error)
{{ $error }}<br>
@endforeach
</div>
@endif
检查这一行:
@if ($errors->has())
has()
用于根据关系过滤选择模型。所以它的行为与正常的非常相似WHERE
健康)状况。如果你只是使用has('relation')
这意味着您只想获取在该关系中至少具有一个相关模型的模型。
has()
必须有一个字符串索引作为其参数来检查它是否存在。但就你而言,它是空白的。
替换以下行:
@if ($errors->has())
with
@if ($errors->count())
然后再试一次。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)