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'));
 }
 /**
  * Finds the Meme model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Meme the loaded model
  * @throws HttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Meme::findOne($id)) !== null) {
         return $model;
     } else {
         throw new HttpException(404, 'The requested page does not exist.');
     }
 }
 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'));
 }