Ejemplo n.º 1
0
 public function api_carousel_items($slug_carousel)
 {
     $carousel = CarouselsModel::find()->where(['slug' => $slug_carousel])->one();
     if ($carousel) {
         if (!$this->_carousel_items) {
             $this->_carousel_items = [];
             foreach (ItemCarousel::find()->status(ItemCarousel::STATUS_ON)->where(['carousel_id' => $carousel->carousel_id])->orderBy(['order_num' => SORT_DESC])->all() as $item) {
                 $this->_carousel_items[] = $item;
             }
         }
         return $this->_carousel_items;
     }
 }