0
我想送$ comment-> id来控制updateComment方法, ,只是更新一列(评论)如何更新数据ID发送到控制器Laravel5.2
这里是我的代码,它带来的错误是这样:ErrorException在BoardController.php线153: 缺少参数1为App \ HTTP \控制器\ BoardController :: updateComment()
查看
<form method="post" action="{{route('comment.update', $comment->id)}}">
<input type="hidden" name="_method" value="put">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<textarea name="comment">'+beforeComment+'</textarea>
<input type="submit" value="등록">
</form>
控制器
public function updateComment($id) {
$comment = comment::findOrFail($id);
$body = Request::input('comment');
$comment->update(['comment' => $body]);
return redirect()->back();
}
路线
Route::match(['put', 'patch'], 'comment', ['as'=>'comment.update', 'uses'=>'[email protected]']);