public function init() { parent::init(); $this->_items = Data::cache(CarouselModel::CACHE_KEY, 3600, function () { $items = []; foreach (CarouselModel::find()->status(CarouselModel::STATUS_ON)->sort()->all() as $item) { $items[] = new CarouselObject($item); } return $items; }); }
<img src="<?php echo \Yii::$app->language == "en" ? $size->image : $size->image_ar; ?> " alt="<?php echo $size->text; ?> " /> <a href="/products/view/dry-go-3x-large" class="title col6"><?php echo $size->title; ?> </a> </div> <div class="col-7 fadeIn wow"> <?php $size7 = \app\modules\drygosizes\models\Carousel::find()->where(['carousel_id' => 7])->one(); ?> <img src="<?php echo \Yii::$app->language == "en" ? $size7->image : $size7->image_ar; ?> " alt="<?php echo $size7->text; ?> " /> <a href="/products/view/dry-go-4x-large" class="title col7"><?php echo $size7->title; ?> </a> </div>
public function actionDelete($id) { if ($model = Carousel::findOne($id)) { $model->delete(); } else { $this->error = Yii::t('easyii', 'Not found'); } return $this->formatResponse(Yii::t('easyii/drygosizesupdated', 'Carousel item deleted')); }