src/BaseAction.php
public function redirect(ActiveRecord $model = null)
    {
        $route = $this->redirectTo;
        $controller = $this->controller;
        $request = Yii::$app->getRequest();

        // if callable
        if ($model && $route instanceof \Closure) {
            $route = call_user_func($route, $model);
        }

        if ($route === null) {
            return $request->getReferrer() ?
                $controller->redirect($request->getReferrer()) : $controller->goHome();
        }

        return $controller->redirect($route);
    }
public function redirect(ActiveRecord $model = null)
    {
        $route = $this->redirectTo;
        $controller = $this->controller;
        $request = Yii::$app->getRequest();

        // if callable
        if ($model && $route instanceof \Closure) {
            $route = call_user_func($route, $model);
        }

        if ($route === null) {
            return $request->getReferrer() ?
                $controller->redirect($request->getReferrer()) : $controller->goHome();
        }

        return $controller->redirect($route);
    }
public function redirect ( ActiveRecord $ model = null ) { $ route = $ this -> redirectTo ; $ controller = $ this -> controller ; $ request = Yii :: $ app -> getRequest ( ) ; // if callable if ( $ model && $ route instanceof \ Closure ) { $ route = call_user_func ( $ route , $ model ) ; } if ( $ route === null ) { return $ request -> getReferrer ( ) ? $ controller -> redirect ( $ request -> getReferrer ( ) ) : $ controller -> goHome ( ) ; } return $ controller -> redirect ( $ route ) ; }
Redirect to route passed as param
@param ActiveRecord $model
@return mixed
Redirect to route passed as param