yii\helpers\BaseUrl::previous PHP Method

previous() public static method

Returns the URL previously [[remember()|remembered]].
See also: remember()
public static previous ( string $name = null ) : string | null
$name string the named associated with the URL that was remembered previously. If not set, it will use [[\yii\web\User::returnUrlParam]].
return string | null the URL previously remembered. Null is returned if no URL was remembered with the given name.
    public static function previous($name = null)
    {
        if ($name === null) {
            return Yii::$app->getUser()->getReturnUrl();
        } else {
            return Yii::$app->getSession()->get($name);
        }
    }

Usage Example

Exemplo n.º 1
0
 public static function previous($name = null)
 {
     if ($name === null) {
         return self::getLastUrl();
     }
     return parent::previous($name);
 }