[ 'class' => 'yii\web\ErrorAction', ], ]; } /** * @inheritdoc */ public function behaviors() { return [ 'verbs' => [ 'class' => VerbFilter::className(), 'actions' => [ 'feedback' => [ 'post' ], ], ], ]; } /** * Displays homepage. * * @return mixed */ public function actionIndex() { $model=new Feedback(); $model->setScenario(Feedback::SCENARIO_CALLBACK); $slides = Slide::find()->with('language')->where(['status' => true])->orderBy('sort')->all(); $articles = Article::find() ->with('language') ->where([ 'status' => true ]) ->orderBy('sort DESC') ->limit(4) ->all(); return $this->render('index', [ 'slides' => $slides, 'articles' => $articles, 'model' => $model ]); } /** * Action to view robots.txt file dinamycli * * @return string */ public function actionRobots() { $response = \Yii::$app->response; /** * @var Settings $settings */ $settings = Settings::find() ->one(); $temp = tmpfile(); fwrite($temp, $settings->robots); $meta = stream_get_meta_data($temp); $response->format = $response::FORMAT_RAW; $response->headers->set('Content-Type', 'text/plain'); return $this->renderFile($meta[ 'uri' ]); } }