Answer the question
In order to leave comments, you need to log in
How to bind comments_table to posts_table in Laravel 4?
There are posts, and you need to tie the ability to add comments.
CommentController
$data = Input::all();
Comment::create($data);
Answer the question
In order to leave comments, you need to log in
Decision.
in routes.php :
Route::post('addcomment/{id}', array(
'as' => 'comment',
'uses' => '[email protected]'
));
{{ Form::model($post, array('action' => array('[email protected]', $post['id']))) }}
// Ваши данные
{{ Form::close() }}
public function add($id){
$data = Input::all();
$new = $id;
$data['post_id'] = $new;
$comment = Comment::add($data);
}
$comment = Comment::create([
//ваши данные
//и id:
'post_id' => $data['post_id']
]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question