private function showList($category = null)
    {
        // eloquent model - VirtualTour::class
        $eloquent = $this->eloqent();

        // base builder
        $builder = $eloquent::with('category')->active();

        // if we need to filter by category
        if ($category && strlen($category) > 2) {

            $category = $this->eloqentCategory()->where('slug', $category)->first();

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

            // increment (dont increment on ajax pagination)
            if (!$this->request->ajax()) {

                // prefix the category in title
                $this->title = $category->title;

                // increment total views
                $category->increment('total_views');
                if ($category->getTable() == 'categories') {
                    $category->increment("views_" . $eloquent->getTable());
                }
            }

            // filter by category
            $builder->where('category_id', $category->id);
        }

        // order by date desc, paginate
        $items = $builder->orderBy('active_from', 'DESC')->paginate($this->paginate);

        // if ajax - paginate the articles
        if ($this->request->ajax()) {

            $view = "website.partials.content.pagination";
            if ($this->view == 'photographies') {
                $view = "website.partials.$this->view.pagination";
            }

            return response()->json(view()->make($view, compact('items'))->render());
        }

        $categories = $this->categoriesHTML($category);
        if ($category) {
            $this->addBreadcrumbLink($category->title, '/content/' . $category->url);
        }

        return $this->view("content.$this->view", compact('categories', 'items'));
    }
private function showList($category = null)
    {
        // eloquent model - VirtualTour::class
        $eloquent = $this->eloqent();

        // base builder
        $builder = $eloquent::with('category')->active();

        // if we need to filter by category
        if ($category && strlen($category) > 2) {

            $category = $this->eloqentCategory()->where('slug', $category)->first();

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

            // increment (dont increment on ajax pagination)
            if (!$this->request->ajax()) {

                // prefix the category in title
                $this->title = $category->title;

                // increment total views
                $category->increment('total_views');
                if ($category->getTable() == 'categories') {
                    $category->increment("views_" . $eloquent->getTable());
                }
            }

            // filter by category
            $builder->where('category_id', $category->id);
        }

        // order by date desc, paginate
        $items = $builder->orderBy('active_from', 'DESC')->paginate($this->paginate);

        // if ajax - paginate the articles
        if ($this->request->ajax()) {

            $view = "website.partials.content.pagination";
            if ($this->view == 'photographies') {
                $view = "website.partials.$this->view.pagination";
            }

            return response()->json(view()->make($view, compact('items'))->render());
        }

        $categories = $this->categoriesHTML($category);
        if ($category) {
            $this->addBreadcrumbLink($category->title, '/content/' . $category->url);
        }

        return $this->view("content.$this->view", compact('categories', 'items'));
    }
private function showList ( $ category = null ) { // eloquent model - VirtualTour::class $ eloquent = $ this -> eloqent ( ) ; // base builder $ builder = $ eloquent :: with ( 'category' ) -> active ( ) ; // if we need to filter by category if ( $ category && strlen ( $ category ) > 2 ) { $ category = $ this -> eloqentCategory ( ) -> where ( 'slug' , $ category ) -> first ( ) ; if ( ! $ category ) { return redirect ( $ this -> URLPrefix ) ; } // increment (dont increment on ajax pagination) if ( ! $ this -> request -> ajax ( ) ) { // prefix the category in title $ this -> title = $ category -> title ; // increment total views $ category -> increment ( 'total_views' ) ; if ( $ category -> getTable ( ) == 'categories' ) { $ category -> increment ( "views_" . $ eloquent -> getTable ( ) ) ; } } // filter by category $ builder -> where ( 'category_id' , $ category -> id ) ; } // order by date desc, paginate $ items = $ builder -> orderBy ( 'active_from' , 'DESC' ) -> paginate ( $ this -> paginate ) ; // if ajax - paginate the articles if ( $ this -> request -> ajax ( ) ) { $ view = "website.partials.content.pagination" ; if ( $ this -> view == 'photographies' ) { $ view = "website.partials.$this->view.pagination" ; } return response ( ) -> json ( view ( ) -> make ( $ view , compact ( 'items' ) ) -> render ( ) ) ; } $ categories = $ this -> categoriesHTML ( $ category ) ; if ( $ category ) { $ this -> addBreadcrumbLink ( $ category -> title , '/content/' . $ category -> url ) ; } return $ this -> view ( "content.$this->view" , compact ( 'categories' , 'items' ) ) ; }
Display all the active resources

@param null $category
@return $this|\Illuminate\Http\JsonResponse
Display all the active resources