0
你好,所以我想在Laravel中使用純html做一個更新表單。我的編輯表單的網址是http://localhost:8000/profile/sorxrob/edit
,sorxrob
是用戶名。而在該網址的代碼是:Laravel 5 Plain Html MethodNotAllowedHttpException
<form class="form-horizontal" role="form" action="" method="POST">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input name="_method" type="hidden" value="PATCH">
//more inputs
</form>
,並在我的控制器命名爲AccountController
:
public function update(Request $request, $id)
{
$account = Accounts::findOrFail($id);
$input = $request->all();
$account->fill($input)->save();
return 'success';
}
而且我得到的錯誤MethodNotAllowedHttpException
當我點擊更新按鈕。是因爲我的行動等於沒有?如果是,那麼在那裏路由的正確方式是什麼?