protected function findModel($id) { if (($model = Banners::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getBanners() { return $this->hasMany(Banners::className(), ['industry_id' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getBanner() { return $this->hasOne(Banners::className(), ['id' => 'banner_id']); }
/** * @return \yii\db\ActiveQuery */ public function getBanners() { return $this->hasMany(Banners::className(), ['provider_id' => 'id']); }
/** * 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()]); }