在嵌套资源中获取父ID

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();
}

make use of _urlManager in yii2

return [
   'class'=>'yii\web\UrlManager',
   'enablePrettyUrl'=>true,
   'showScriptName'=>false,
   'rules'=>[
      // url rules
      'posts/<post_id:\d+>/comments' => 'posts/index',

     ]
 ];