Get the current resource
@param $category
@return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
968443
private function getResource($category)
    {
        $category = $this->eloqentCategory()->where('slug', $category)->first();

        if (!$category) {
            return redirect($this->URLPrefix);
        }

        // eloquent model - VirtualTour::class
        $eloquent = $this->eloqent();

        // prefix the / -> the way we save it in db
        $url = '/' . ltrim($this->getCurrentUrl(), '/');
        $item = $eloquent::with('category')->where('url', $url)->first();

        if (!$item) {
            return redirect($this->URLPrefix);
        }

        $item->increment('total_views');

        return $item;
    }
945092
protected function getModuleByTransCategory($category)
    {
        foreach(TranslationsBuilder::$transCatToModule as $pattern => $module) {
            if (0 === strpos($category, rtrim($pattern, '*'))) {
                return $module;
            }
        }
    }
431387
public function destroy(Category $category)
    {
        $category->delete();

        return intend([
            'url' => route('adminarea.categories.index'),
            'with' => ['warning' => trans('cortex/foundation::messages.resource_deleted', ['resource' => trans('cortex/categories::common.category'), 'identifier' => $category->name])],
        ]);
    }
503883
protected function getSelectedCategory($categorySlug = null)
    {
        $selectedCategory = null;

        if ($categorySlug !== null) {
            $selectedCategory = $this->getCategoryRepository()->findOneBy(array('isActive' => true, 'slug' => $categorySlug));
        }

        return $selectedCategory;
    }
849273
public function findByCategory($category)
    {
        return $this->createQueryBuilder('p')
            ->leftJoin('Ekino\WordpressBundle\Entity\TermRelationships', 'tr', 'WITH', 'p.id = tr.post')
            ->leftJoin('Ekino\WordpressBundle\Entity\Term', 't', 'WITH', 't.id = tr.taxonomy')
            ->where('t.name = :category')
            ->setParameter('category', $category)
            ->getQuery()->getResult();
    }
1233185
public function display($category)
    {

        $view = (View::exists("block::{$category}")) ? "block::{$category}" : "block::default";
        
        $category = $this->category
            ->scopeQuery(function ($query) use ($category) {
                return $query->with('blocks')->whereSlug($category);
            })->first();

        $blocks = $category->blocks;
        return view($view, compact('blocks', 'category'))->render();
    }
1337260
private function getCategorySearchQuery(CategoryInterface $category)
    {
        $virtualRule = $category->getVirtualRule();
        if (!($virtualRule instanceof VirtualRuleInterface)) {
            return $this->loadVirtualRule($category)->getCategorySearchQuery($category);
        }

        return $this->helper->loadUsingCache($category, 'getCategorySearchQuery');
    }
1111963
public function getBranchByCategory(Category $category, $lang = null)
    {
        $this->initNodeVersions();

        $lang = $lang ?: $this->currentLocale->getCurrentLocale();

        $matches = function (Branch $branch) use ($category, $lang) {
            return $category->getNodeId() === $branch->getNodeId() && $lang === $branch->getLang();
        };

        return array_reduce($this->branches, function (Branch $result = null, Branch $branch) use ($matches) {
            return  $matches($branch) ? $branch : $result;
        });
    }
495006
public function current()
    {
        $port = Current::port();
        if (! $port || ! $prefix = $port->prefix()) {
            return $this->to($this->request->getPathInfo());
        }

        return $this->to($this->getPathInfo());
    }
820973
private function RedirectUrl()
    {
        if ($this->logout->GetNextUrl())
        {
            return FrontendRouter::Url($this->logout->GetNextUrl());
        }
        return CurrentUrl();
    }
868462
public function addCategoryToCrawlerQueue($category) {
        $catUrls = array();
        $origStore = Mage::app()->getStore();
        foreach (Mage::app()->getStores() as $storeId => $store) {
            Mage::app()->setCurrentStore($store);
            $catUrls[] = $category->getUrl();
        }
        Mage::app()->setCurrentStore($origStore);
        return $this->addUrlsToCrawlerQueue($catUrls);
    }
400561
private function getCurrentPath()
    {
        if (is_null($this->currentPath)) {
            $this->currentPath = $this->str($this->httpRequest()->getCurrentUrl(true)->getPath());
        }

        return $this->currentPath;
    }
903970
public function get($category, $key = null, $default = null)
    {
        $this->load($category);

        if ($key === null) {
            return isset($this->items[$category]) && !empty($this->items[$category]) ? $this->items[$category] : $default;
        }

        if (is_string($key)) {
            return isset($this->items[$category][$key]) ? $this->items[$category][$key] : $default;
        }

        if (is_array($key)) {
            $result = [];
            foreach ($key as $val) {
                $result[$val] = isset($this->items[$category][$val]) ? $this->items[$category][$val] : (is_array($default) && isset($default[$val]) ? $default[$val] : null);
            }
            return $result;
        }

        return $default;
    }
384167
public function getCurrentCategory()
    {
        /**
         * @var Blog $dataRecord
         */
        $dataRecord = $this->dataRecord;
        $category = $this->request->param('Category');
        if ($category) {
            $filter = URLSegmentFilter::create();
            // url encode unless it's multibyte (already pre-encoded in the database)
            // see https://github.com/silverstripe/silverstripe-cms/pull/2384
            if (!$filter->getAllowMultibyte()) {
                $category = rawurlencode($category);
            }

            return $dataRecord->Categories()
                ->filter('URLSegment', $category)
                ->first();
        }
        return null;
    }
1083592
public function getModules(string $category) {
        if (isset($this->modules[$category])) {
            return $this->modules[$category];
        }

        return null;
    }
1367794
public function update(NewsCategory $category, Request $request)
	{
		$attributes = request()->validate(NewsCategory::$rules, NewsCategory::$messages);

        $category = $this->updateEntry($category, $attributes);

        return redirect_to_resource();
	}
293824
protected function getProviderFromCategory(CategoryInterface $category = null)
    {
        if (null === $category) {
            return null;
        }

        $product = $this->getProductSetManager()->findProductForCategory($category);

        return $product ? $this->getProductPool()->getProvider($product) : null;
    }