12345678910111213141516171819202122232425262728 |
- <?php
- namespace app\controllers;
- use app\models\Authors;
- use yii\web\Controller;
- use yii\web\NotFoundHttpException;
- class AuthorController extends \yii\web\Controller
- {
- public function actionIndex()
- {
- return $this->render('index');
- }
- public function actionView($author){
- if( is_numeric($author) ){
- $model = Authors::findOne(['id'=>$author]);
- }else{
- $model = Authors::findOne(['url'=>$author]);
- }
- if( ( !$model instanceof Authors ) || $model->show == 0 ){
- throw new NotFoundHttpException("Автор не найден");
- }
- return $this->render("person",["model"=>$model]);
- }
- }
|