Im trying to get all comments under post #{any nos.}
, but I'm stuck on how can I get the post_id
when I hit the URI below. for example post #1
on GET URI : /posts/1/comments/
on CommentController :
public function actions() {
$actions = parent::actions();
unset($actions['index']);
return $actions;
}
public function actionIndex($post_id)
{
return Comments::find()->where(['post_id' => $post_id])->all();
}