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;
    }
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;
    }
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 ; }
Get the current resource
@param $category
@return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
Get the current resource