我正在尝试显示登录凭据的错误消息
来自API的响应:
{#291 ▼
+"error": "invalid_credentials"
+"error_description": "The user credentials were incorrect."
+"message": "The user credentials were incorrect."
}
刀片HTML:
@if($errors->any())
<ul class="alert alert-danger form-group row">
@foreach ($errors->all() as $error)
<li >{{ $error }}</li>
@endforeach
</ul>
@endif
但是我只收到错误消息invalid_credentials。
现在,我希望消息显示在我的刀片视图上。 谁能帮助我完成这项工作。
谢谢。
答案 0 :(得分:0)
您只是从错误中显示$ error
变量。如果您只想显示消息,请将代码更改为以下内容:
@if($errors->any())
<ul class="alert alert-danger form-group row">
@foreach ($errors->all() as $error)
<li >{{ $error->message}}</li>
@endforeach
</ul>
@endif
未经测试,但应该会给您想要的结果。