Return view (list, create) and check permissions.

@param  string $lang
@param  string $postTypeSlug
@param  $view
@return \Illuminate\Contracts\View\Factory|\Illuminate\Http\Response|\Illuminate\View\View
333674
public function postsIndex($lang, $postTypeSlug, $view)
    {
        $postType = PostType::findBySlug($postTypeSlug);
        if(!$postType) {
            return response()->view('errors.404', ['message' => "This post type does not exist!"], 404);
        }

        // check if user has permissions to access this link
        $key = ($view == 'list') ? 'read' : $view;
        if(!User::hasAccess($postTypeSlug, $key)) {
            return view('errors.permissions');
        }

        return view('content');
    }
1057647
public function retrieve($view, $viewId, $viewLocale)
    {
        if (ConfigQuery::isRewritingEnable()) {
            $this->retriever->loadViewUrl($view, $viewLocale, $viewId);
        } else {
            $allParametersWithoutView = array();
            $allParametersWithoutView['lang'] = $viewLocale;
            if (null !== $viewId) {
                $allParametersWithoutView[$view . '_id'] = $viewId;
            }
            $this->retriever->rewrittenUrl = null;
            $this->retriever->url = URL::getInstance()->viewUrl($view, $allParametersWithoutView);
        }

        return $this->retriever;
    }
313876
public function createUiComponent(\n2n\impl\web\ui\view\html\HtmlView $view, \rocket\ei\util\Eiu $eiu) {
		return $view->getHtmlBuilder()->getEsc($eiu->field()->getValue());
	}
146609
public function of($view, $args = array(), $type = null)
    {
        // Layout.
        $layout = ucfirst($this->layout);

        // Fire event global assets.
        $this->fire('asset', $this->asset);

        // Fire event before render theme.
        $this->fire('beforeRenderTheme', $this);

        // Fire event before render layout.
        $this->fire('beforeRenderLayout.'.$this->layout, $this);

        // Keeping arguments.
        $this->arguments = $args;

        // Compile string blade, string twig, or from file path.
        switch ($type) {
            case 'blade' :
                $content = $this->bladerWithOutServerScript($view, $args);
                break;
            case 'twig' :
                $content = $this->twigy($view, $args);
                break;
            default :
                $content = $this->view->make($view, $args)->render();
                break;
        }

        // View path of content.
        $this->content = $view;

        // Set up a content regional.
        $this->regions['content'] = $content;

        return $this;
    }
159179
public function single($lang, $view, $id)
    {
        $classNameArr = explode("\\", get_class($this));
        $className = str_replace("Controller", "", $classNameArr[4]);
        // if we are accessing Post Type check if we are are in category or tags and repair the class name and key for them
        $key = $view;
        if($className === "PostType") {
            if(strpos($key, 'category') !== false) {
                $className = 'Categories';
                // make categorylist to list, categoryupdate to update etc
                $key = str_replace('category', '', $key);
            }else if(strpos($key, 'tag') !== false) {
                // make taglist to list, tagupdate to update etc
                $className = 'Tags';
                $key = str_replace('tag', '', $key);
            }
        }

        $key = ($key == "list" || $key == "posts") ? 'read' : $key;
        // check if user has permissions to access this link
        if($key == 'read') {
            if(!User::hasAccess($className, $key)) {
                return view('errors.permissions', compact('lang', 'view', 'id'));
            }
        }else{
            if(!User::hasAccess($className, $key, $id, true)) {
                return view('errors.permissions', compact('lang', 'view', 'id'));
            }
        }

        return view('content');
    }
73427
protected function view($view, $data = [])
    {
        return parent::view($view, $data)
            ->with('resource', $this->resource)
            ->with('navigation', $this->navigation)
            ->with('pagecrumbItems', $this->pagecrumbItems)
            ->with('breadcrumbItems', $this->breadcrumbItems)
            ->with('selectedNavigation', $this->selectedNavigation)
            ->with('selectedNavigationParents', $this->urlParentNavs);
    }
114711
protected function accessBlob( $domain, $lang, $key ) {
		if ( !isset( $this->messageBlob[$domain][$lang][$key] ) ) {
			return null;
		}
		return $this->messageBlob[$domain][$lang][$key];
	}
853308
public function actionViewBySlug($slug)
    {
        $lh = $this->module->langHelper;
        $language = $lh::normalizeLangCode(Yii::$app->language);

        $model = null;
        $modelI18n = $this->module->model('NewsI18n')->findOne([
            'slug' => $slug,
            'lang_code' => $language,
        ]);

        // but after language switching slug for article on another language can be another
        if (empty($modelI18n)) {  // try to get language from referer
            $referer = Yii::$app->request->referrer;
            $hostInfo = Yii::$app->request->hostInfo;
            if (0 === strpos($referer, $hostInfo)) {
                $previousLanguage = substr($referer, strlen($hostInfo) + 1, 2);
                $previousLanguage = $lh::normalizeLangCode($previousLanguage);
                $modelI18n = $this->module->model('NewsI18n')->findOne([
                    'slug' => $slug,
                    'lang_code' => $previousLanguage,
                ]);
                if (!empty($modelI18n)) {  // found i18n-model for previous language
                    $model = $modelI18n->getMain()->one();  // get common model
                    if (!empty($model)) {
                        $modelsI18n = $model::prepareI18nModels($model);
                        if (!empty($modelsI18n[$language])) {
                            // do now show page with illegal slug in URL - prepare to redirect with correct slug
                            $newSlug = $modelsI18n[$language]->slug;
                            $result = Yii::$app->getUrlManager()->parseRequest(Yii::$app->request);
                            if (is_array($result)) {
                                list ($route, $routeParams) = $result;
                                $routeParams[0] = $route;
                                $routeParams['lang'] = $language;
                                $routeParams['slug'] = $newSlug;
                                $link = Yii::$app->urlManager->createUrl($routeParams);
                                return $this->redirect($link);
                            }                
                        }
                    }
                }
            }
        }
        
        if (!empty($modelI18n)) {
            $contentHelper = new $this->contentHelperClass;
            $modelI18n->body = $contentHelper::afterSelectBody($modelI18n->body);
            $model = $modelI18n->getMain()->one();
        }

        $searchModel = $this->module->model('NewsSearchFront');
        $model = $searchModel::canShow($model, $modelI18n);
        if (!$model) {
            $modelI18n = false;
        }

        return $this->render('view', compact('model', 'modelI18n'));
    }
149903
public function addPage(Lang $lang, string $name, string $view, int $parentPageId = 0, bool $isPublished = FALSE) : Page
    {
        if ($parentPageId === 0)
        {
            $parentPage = $this->pageRepository->findOneLangRoot($lang);
        }
        else
        {
            $parentPage = $this->pageRepository->findOneById($parentPageId);
        }

        $pageByName = $this->pageRepository->findOneByName($name);

        if ($pageByName)
        {
            throw new DatabaseException("Stránka s názvem '{$name}' již existuje");
        }

        $page = new Page;
        $page->setParent($parentPage);
        $page->insertAsLastChildOf($parentPage);
        $page->setName($name);
        $page->setView($view);
        $page->setPublished($isPublished);
        $page->save();

        return $page;
    }
843535
public function render($view = null)
    {
        $this->findActivePage();
        $this->filterByAccessRights();
        $this->filterEmptyPages();

        $this->sort();

        if (is_null($view)) {
            $view = config('navigation.view.navigation', 'navigation::navigation');
        }

        return view($view, $this->toArray())->render();
    }
1243757
public function menuPanelItems($lang = "")
    {
        // check if user has permissions to access this link
        if(!User::hasAccess('PostType', 'read')) {
            return $this->noPermission();
        }

        // Find categories
        $categoryObj = Category::visible();
        if(Input::input('keyword')) {
            $categoryObj->where('title', 'like', '%'.Input::input('keyword').'%');
        }
        $categoryObj->orderBy('postTypeID', 'ASC');
        $categories = $categoryObj->paginate(25);

        // Append menuLink Parameters
        foreach($categories->all() as $category){
            $postTypeData = PostType::findByID($category->postTypeID);
            $category->postTypeName = $postTypeData->name;
            $category->belongsTo = 'category';
            $category->belongsToID = $category->categoryID;
            $category->label = $category->title;
            $category->menuLinkParameters = $category->menuLinkParameters();
        }

        // Append columns
        $results = $categories->toArray();
        $results['columns']= [
            'categoryID' => trans('id'),
            'title' => trans('base.title'),
            'postTypeName' => trans('postTypes.title'),
        ];

        return $results;
    }
1070868
public function view($view, $data = array(), $status = 200, array $headers = array())
	{
		return static::make($this->view->make($view, $data), $status, $headers);
	}
563210
protected function selfFormat(XType $type, $value, $view, $lang)
    {

        if ($type instanceof BoolType) {
            return $this->formatBool($type, $value, $view, $lang);
        }

        if ($type instanceof UnitType) {
            return $this->formatUnit($type, $value, $view, $lang);
        }

        if ($type instanceof NumberType) {
            return $this->formatNumber($type, $value, $view, $lang);
        }

        if ($type instanceof StringType) {
            return $this->formatString($type, $value, $view, $lang);
        }

        if ($type instanceof TemporalType) {
            return $this->formatTemporal($type, $value, $view, $lang);
        }

        return 'NaN';
    }
1352551
public function delete($lang, $id)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess('PostType', 'delete')) {
            return $this->noPermission();
        }

        $res = $this->deletePostType($id);
        if($res && is_bool($res)) {
            return $this->response('Post Type is successfully deleted');
        }
        if($res && !is_bool($res)) {
            return $res;
        }
        return $this->response('Post Type could not be deleted. Please try again later or contact your Administrator!', 500);
    }
409276
public function watchWithLayout($view, $args = array(), $type = null)
    {
        try {
            return $this->scopeWithLayout($view, $args, $type);
        } catch (\InvalidArgumentException $e) {
            return $this->ofWithLayout($view, $args, $type);
        }
    }
47046
public function ofWithLayout($view, $args = array(), $type = null)
    {
        $view = $this->getLayoutName().'.'.$view;

        return $this->of($view, $args, $type);
    }
779131
public function getCreateViewSQLQueries(View $view)
    {
        if (!$this->supportViews()) {
            throw PlatformException::methodNotSupported(__METHOD__);
        }

        return array('CREATE VIEW '.$view->getName().' AS '.$view->getSQL());
    }