src/traits/AdminResponse.php
public function renderResponse($view, $params = [])
    {
        /** @var \DevGroup\AdminUtils\controllers\BaseController $context */
        $context = $this instanceof Action ? $this->controller : $this;
        if (Yii::$app->request->isAjax === true) {
            Yii::$app->response->format = Response::FORMAT_JSON;

            $content = $context->renderAjax($view, $params);
            return new AjaxResponse($content, false, Yii::$app->session->getAllFlashes(true));
        } else {
            return $context->render($view, $params);
        }
    }
public function renderResponse($view, $params = [])
    {
        /** @var \DevGroup\AdminUtils\controllers\BaseController $context */
        $context = $this instanceof Action ? $this->controller : $this;
        if (Yii::$app->request->isAjax === true) {
            Yii::$app->response->format = Response::FORMAT_JSON;

            $content = $context->renderAjax($view, $params);
            return new AjaxResponse($content, false, Yii::$app->session->getAllFlashes(true));
        } else {
            return $context->render($view, $params);
        }
    }
public function renderResponse ( $ view , $ params = [ ] ) { /** @var \DevGroup\AdminUtils\controllers\BaseController $context */ $ context = $ this instanceof Action ? $ this -> controller : $ this ; if ( Yii :: $ app -> request -> isAjax === true ) { Yii :: $ app -> response -> format = Response :: FORMAT_JSON ; $ content = $ context -> renderAjax ( $ view , $ params ) ; return new AjaxResponse ( $ content , false , Yii :: $ app -> session -> getAllFlashes ( true ) ) ; } else { return $ context -> render ( $ view , $ params ) ; } }
Generates response for current request based on it's type

@param string $view
@param array  $params

@return \DevGroup\AdminUtils\response\AjaxResponse|string
Generates response for current request based on it s type