/** * Displays a single Status model. * @param string $slug * @return mixed */ public function actionSlug($slug) { $model = Content::find()->where(['slug' => $slug])->one(); if (!is_null($model)) { return $this->render('single', ['model' => $model, 'latestPosts' => Content::findLatestBySection($model->section_id, 10), 'rubrics' => ContentRubrics::findBySection($model->section_id)]); } else { return $this->redirect('/index'); } }
/** * Displays homepage. * * @return mixed */ public function actionIndex() { return $this->render('index', ['methodsPromo' => Content::bySection(4, 1), 'methodsLast' => Content::findLatestBySection(4, 7), 'calculatorsPromo' => Content::bySection(7, 1), 'calculatorsLast' => Content::findLatestBySection(7, 7), 'eventsPromo' => Content::bySection(8, 2), 'eventsLast' => Content::findLatestBySection(8, 7)]); }