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'));
 }
Exemplo n.º 2
0
 /**
  * Finds the Author model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Author the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Author::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 3
0
 public function beforeDelete()
 {
     if (parent::beforeDelete()) {
         $author = Author::findOne($this->author_id);
         $author->recount--;
         $author->save();
         return true;
     } else {
         return false;
     }
 }
Exemplo n.º 4
0
 public function actionAccount($id)
 {
     $account = Author::findOne(['id' => $id]);
     if (!$account) {
         return $this->run('error');
     }
     return $this->render('account', ['account' => $account]);
 }