【发布时间】:2013-05-22 08:21:30
【问题描述】:
页面http://localhost/posts/post_id有一个评论表单
当我提交表单时,我想将post_id 值附加到Input::all(),因为表单不包含post_id 的输入字段。而post_id在评论表中的列名叫做post_id,创建评论的路径是comments.store
任何想法?谢谢!
【问题讨论】:
-
你的路线是什么样的?
Route::post('posts/{post_id}/comments', 'CommentsController@store')? -
它是一个资源控制器。
Route::resource('comments', 'CommentsController');