【发布时间】:2019-07-13 07:59:45
【问题描述】:
在 URL 用户/密码/更改我有一个表单:
{!! Form::open(array('route' => 'password.recover')) !!}
<div class="form-group">
<label for="email">Email Address</label>
<input type="email" class="form-control" name="email" id="email" value="{{ old('email') }}" />
</div>
<div class="form-group">
<label for="password">New Password</label>
<input type="password" class="form-control" name="password" id="password" />
</div>
<div class="form-group">
<label for="password_confirmation">New Password (again)</label>
<input type="password" class="form-control" name="password_confirmation" id="password_confirmation" />
</div>
<div class="form-group">
<label for="password_confirmation">Verification Code (from text message)</label>
<input type="text" class="form-control" name="verification_code" id="verification_code" />
</div>
<button type="submit" class="btn btn-primary btn-block">Reset Password</button>
{!! Form::close() !!}
该表单位于刀片views/auth/reset.blade.php
表单操作正在我的 routes.auth 文件中调用此路由:
Route::post('password/recover', 'Auth\AuthController@reset')
->name('password.recover');
问题是当我提交表单时出现MethodNotAllowedHTTPException 错误。如果我从错误页面点击返回,那么我的表单会加载我的表单验证错误(因为表单提交为空)。所以它在我的 AuthController 中点击了重置功能,但它有某种路由错误。如果我尝试提交空表单,它应该只重新加载包含错误的页面,而不是给出异常错误。
我在这里遗漏了一些非常明显的东西吗?
【问题讨论】:
-
Form::open(array('route' => 'password.recover', 'method'=>'post'))