在http://localhost/posts/post_id
页有一个评论表单
当我提交表单时,我想将post_id
值附加到Input::all()
,因为表单不包括post_id
的输入字段。post_id在评论表中的列名是post_id
,创建评论的路由是comments.store
任何想法?谢谢!
我认为这应该可以工作:Input::merge(array('post_id' => $post_id));
这个怎么样?
function store($post_id)
{
$data = Input::all();
$comment = new Comment($data);
$comment->post_id = $post_id;
$comment->save();
}
就用这个:
Request::instance()->query->set('key','value');