protected function findModel($id) { if (($model = Advantages::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * Displays homepage. * * @return mixed */ public function actionIndex() { $products = Product::find()->active()->all(); return $this->render('index', ['products' => $products, 'banners' => Banners::find()->asArray()->all(), 'advantages' => Advantages::find()->asArray()->all()]); }