public function actionIndex($slug) { $query = Vidmage::find()->joinWith('vidmageCategories.category')->where(['category.slug' => $slug])->orderBy(['id' => SORT_DESC]); $vidmages = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10]]); $channel = Category::findOne(['slug' => $slug]); return $this->render('index', compact('vidmages', 'channel')); }
public function actionIndex($slug) { $query = Vidmage::find()->joinWith('vidmageTags.tag')->where(['tag.name' => $slug])->orderBy(['id' => SORT_DESC]); $vidmages = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10]]); $tag = Tag::findOne(['name' => $slug]); return $this->render('index', compact('vidmages', 'tag')); }
public function actionIndex($slug) { $query = Vidmage::find()->joinWith('vidmageAuthors.author')->where(['author.slug' => $slug])->orderBy(['id' => SORT_DESC]); $vidmages = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10]]); $author = Author::findOne(['slug' => $slug]); return $this->render('index', compact('vidmages', 'author')); }
public function actionIndex($slug) { $meme = Meme::findOne(['slug' => $slug]); $query = Vidmage::find()->joinWith('memeVidmages.meme')->where(['meme.id' => $meme->id])->andWhere(['meme_vidmage.is_the_origin' => false]); $vidmages = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10]]); return $this->render('index', compact('meme', 'vidmages')); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Vidmage::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'user_id' => $this->user_id, 'platform_id' => $this->platform_id, 'views' => $this->views, 'is_active' => $this->is_active, 'created_by' => $this->created_by, 'updated_by' => $this->updated_by, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'slug', $this->slug])->andFilterWhere(['like', 'id_url', $this->id_url]); return $dataProvider; }
<?php use yii\helpers\Html; use common\models\Category; use common\models\Tag; use common\models\Author; use common\models\Meme; use common\models\Vidmage; use common\helpers\Tools; $channels = Category::find()->all(); $tags = Tag::find()->orderBy(['recount' => SORT_DESC])->limit(10)->all(); $authors = Author::find()->orderBy(['recount' => SORT_DESC])->limit(5)->all(); $latestMemes = Meme::find()->orderBy(['id' => SORT_DESC])->limit(10)->all(); $latestReplicas = Vidmage::find()->joinWith('memeVidmages')->where(['meme_vidmage.is_the_origin' => false])->orderBy(['id' => SORT_DESC])->limit(10)->all(); ?> <?php echo $this->render('_left-column-list-items', ['items' => $latestMemes, 'title' => 'Latest Memes', 'icon' => 'globe', 'divId' => 'latest-memes', 'class' => 'success']); ?> <?php echo $this->render('_left-column-list-items', ['items' => $latestReplicas, 'title' => 'Latest Replicas', 'icon' => 'film', 'divId' => 'latest-replicas', 'class' => 'info']); ?> <?php echo $this->render('_left-column-list-items', ['items' => $channels, 'title' => 'Channels', 'icon' => 'blackboard', 'divId' => 'channels', 'class' => 'warning']); ?> <?php echo $this->render('_left-column-list-items', ['items' => $tags, 'title' => 'Trending Tags', 'icon' => 'tag', 'divId' => 'tags', 'class' => 'danger']); ?>
public function actionIndex() { $mostPopularMeme = Meme::mostPopular(); $newReplicas = Vidmage::find()->joinWith('memeVidmages')->where(['meme_vidmage.is_the_origin' => false])->orderBy(['id' => SORT_DESC])->limit(4)->all(); $editorMemePick = Meme::findOne(7); $newMemes = Meme::find()->joinWith('memeVidmages')->where(['meme_vidmage.is_the_origin' => true])->orderBy(['id' => SORT_DESC])->limit(4)->all(); return $this->render('index', compact('mostPopularMeme', 'newReplicas', 'editorMemePick', 'newMemes')); }