public function run()
 {
     $model = new Comments();
     $query = $model->queryByUser($this->id);
     $pagination = new Pagination(['defaultPageSize' => 10, 'totalCount' => $query->count()]);
     $elements = $query->orderBy($model->order)->offset($pagination->offset)->limit($pagination->limit)->all();
     return $this->render('getElementsByUser/index', ['elements' => $elements, 'pagination' => $pagination, 'id' => $this->id]);
 }
 public function actionCreate($table_id, $table_name)
 {
     $model = new Comments();
     if (isset(Yii::$app->request->post()[Comments])) {
         $loadArray = array_merge(Yii::$app->request->queryParams, Yii::$app->request->post()[Comments]);
         if ($model->load([Comments => $loadArray])) {
             $model->createdby = \Yii::$app->user->getId();
             $model->createdon = date('Y-m-d H:i:s', time());
             if ($model->save()) {
                 return $this->redirect(['index', 'id' => $table_id]);
             } else {
                 throw new NotFoundHttpException('The requested page not allowed.');
             }
         } else {
             return $this->render('create', ['model' => $model, 'id' => $table_id]);
         }
     } else {
         return $this->render('create', ['model' => $model, 'id' => $table_id]);
     }
 }