itstructure /
yii2-template-multilanguage
| 1 | <?php |
||
| 2 | |||
| 3 | namespace app\controllers; |
||
| 4 | |||
| 5 | use app\models\{Home, About, User}; |
||
| 6 | use yii\filters\{AccessControl, VerbFilter}; |
||
| 7 | use yii\helpers\ArrayHelper; |
||
| 8 | |||
| 9 | /** |
||
| 10 | * Class HomeController |
||
| 11 | * |
||
| 12 | * @package app\controllers |
||
| 13 | */ |
||
| 14 | class HomeController extends BaseController |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @return array |
||
| 18 | */ |
||
| 19 | public function behaviors() |
||
| 20 | { |
||
| 21 | return ArrayHelper::merge(parent::behaviors(), [ |
||
| 22 | 'access' => [ |
||
| 23 | 'class' => AccessControl::class, |
||
| 24 | 'rules' => [ |
||
| 25 | [ |
||
| 26 | 'allow' => true, |
||
| 27 | 'actions' => ['index'], |
||
| 28 | 'roles' => ['?', '@'], |
||
| 29 | ], |
||
| 30 | ], |
||
| 31 | ], |
||
| 32 | 'verbs' => [ |
||
| 33 | 'class' => VerbFilter::class, |
||
| 34 | 'actions' => [ |
||
| 35 | 'index' => ['get'], |
||
| 36 | ], |
||
| 37 | ] |
||
| 38 | ]); |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Displays homepage. |
||
| 43 | * |
||
| 44 | * @return string |
||
| 45 | */ |
||
| 46 | public function actionIndex() |
||
| 47 | { |
||
| 48 | $model = Home::getDefaultHome(); |
||
| 49 | |||
| 50 | $this->setMetaParams($model); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 51 | |||
| 52 | return $this->render('index', [ |
||
| 53 | 'model' => $model, |
||
| 54 | 'about' => About::getDefaultAbout(), |
||
| 55 | 'team' => User::getPublicUsers() |
||
| 56 | ]); |
||
| 57 | } |
||
| 58 | } |
||
| 59 |