goHome() публичный метод

You can use this method in an action by returning the Response directly: php stop executing this action and redirect to home page return $this->goHome();
public goHome ( ) : Response
Результат Response the current response object
Пример #1
0
<?php

use yii\helpers\Html;
if (Yii::$app->user->isGuest) {
    \yii\web\Controller::goHome();
}
?>

<!-- User Account: style can be found in dropdown.less -->

                <li class="dropdown user user-menu">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <img src="<?php 
echo $directoryAsset;
?>
/img/user2-160x160.jpg" class="user-image" alt="User Image"/>
                        <span class="hidden-xs"><?php 
echo Yii::$app->user->identity->username;
?>
</span>
                    </a>
                    <ul class="dropdown-menu">
                        <!-- User image -->

                        <li class="user-header">
                            <img src="<?php 
echo $directoryAsset;
?>
/img/user2-160x160.jpg" class="img-circle"
                                 alt="User Image"/>
                            <p>