【发布时间】:2014-06-25 03:00:50
【问题描述】:
用户控制器:
public function update($id)
{
if( ! $this->user->isValid(Input::all()))
{
return Redirect::back()->withInput()->withErrors($this->user->errors);
}
$user = $this->user->find($id);
$user->save();
return Redirect::route('users.index');
}
路线:
Route::resource('users','UsersController');
型号:
protected $table = 'users'
edit.blade.php:
{{ Form::model($user, array('route'=>array('users.update','$user'=>'id'))) }}
我注意到这不会生成“PUT”操作。页面来源:
<form method="POST" action="https://zocios.com/users/id" accept-charset="UTF-8"><input name="_token" type="hidden" value="...">
点击更新用户按钮让我:
Exception \ MethodNotAllowedHttpException
问题是“$user->save();”吗?还有什么我做错了吗?谢谢!
【问题讨论】: