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