Example #1
0
 protected function findModel($id)
 {
     if (($model = \app\models\db\Books::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('Страница не найдена.');
     }
 }
Example #2
0
 public function getBooks()
 {
     return $this->hasMany(Books::className(), ['author_id' => 'id']);
 }