[ 'class' => VerbFilter::className(), 'actions' => [ 'delete' => ['POST'], ], ], ] ); } /** * Lists all Comments models. * * @return string */ public function actionIndex() { $searchModel = new CommentsSearch(); $dataProvider = $searchModel->search(\Yii::$app->request->get()); return $this->render('index', [ 'dataProvider' => $dataProvider, 'searchModel' => $searchModel, ]); } /** * Displays a single Comments model. * @param int $id * @return string * @throws NotFoundHttpException if the model cannot be found */ public function actionView($id) { return $this->render('view', [ 'model' => $this->findModel($id), ]); } /** * Lists all Comments models. * * @return string */ public function actionRss() { $model = new Comments(); $dataProvider = new \yii\data\ActiveDataProvider( [ "query"=>$model->find(), "pagination" =>[ "pageSize"=>200 ], 'sort' => [ 'defaultOrder' => [ 'created_at' => SORT_DESC, ] ], ]); return $this->renderPartial('rss', [ 'dataProvider' => $dataProvider, ]); } /** * Finds the Comments model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param int $id * @return Comments the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = CommentsSearch::findOne(['id' => $id])) !== null) { return $model; } throw new NotFoundHttpException('The requested page does not exist.'); } }