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