public function getIndex(Request $request, $path = null)
    {
        $items = Item::active();

        if ($request->input('q')) {
            $items->keywords($request->input('q'));
        }

        // Handle root
        if (is_null($path)) {
            $category = null;
        } else {
            $tree = explode('/', $path);

            $category = Category::findBySlug(array_slice($tree, -1)[0]);

            $items->whereHas('categories', function ($query) use ($category) {
                $query->whereIn(
                    'categories.category_id',
                    array_merge($category->getDescendantIds(), [$category->getKey()])
                );
            });
        }

        $table = new ListingItems($items, $request);

        $table->with('categories');

        if (mustard_loaded('auctions')) {
            $table->with('bids');
        }

        if (mustard_loaded('media')) {
            $table->with('photos');
        }

        return view('mustard::listings.list', [
            'categories' => Category::roots()
                ->with('children')
                ->orderBy('sort', 'asc')
                ->orderBy('name', 'asc')
                ->get(),
            'table'         => $table,
            'items'         => $table->paginate(),
            'view_category' => $category,
        ]);
    }
public function getIndex(Request $request, $path = null)
    {
        $items = Item::active();

        if ($request->input('q')) {
            $items->keywords($request->input('q'));
        }

        // Handle root
        if (is_null($path)) {
            $category = null;
        } else {
            $tree = explode('/', $path);

            $category = Category::findBySlug(array_slice($tree, -1)[0]);

            $items->whereHas('categories', function ($query) use ($category) {
                $query->whereIn(
                    'categories.category_id',
                    array_merge($category->getDescendantIds(), [$category->getKey()])
                );
            });
        }

        $table = new ListingItems($items, $request);

        $table->with('categories');

        if (mustard_loaded('auctions')) {
            $table->with('bids');
        }

        if (mustard_loaded('media')) {
            $table->with('photos');
        }

        return view('mustard::listings.list', [
            'categories' => Category::roots()
                ->with('children')
                ->orderBy('sort', 'asc')
                ->orderBy('name', 'asc')
                ->get(),
            'table'         => $table,
            'items'         => $table->paginate(),
            'view_category' => $category,
        ]);
    }
public function getIndex ( Request $ request , $ path = null ) { $ items = Item :: active ( ) ; if ( $ request -> input ( 'q' ) ) { $ items -> keywords ( $ request -> input ( 'q' ) ) ; } // Handle root if ( is_null ( $ path ) ) { $ category = null ; } else { $ tree = explode ( '/' , $ path ) ; $ category = Category :: findBySlug ( array_slice ( $ tree , - 1 ) [ 0 ] ) ; $ items -> whereHas ( 'categories' , function ( $ query ) use ( $ category ) { $ query -> whereIn ( 'categories.category_id' , array_merge ( $ category -> getDescendantIds ( ) , [ $ category -> getKey ( ) ] ) ) ; } ) ; } $ table = new ListingItems ( $ items , $ request ) ; $ table -> with ( 'categories' ) ; if ( mustard_loaded ( 'auctions' ) ) { $ table -> with ( 'bids' ) ; } if ( mustard_loaded ( 'media' ) ) { $ table -> with ( 'photos' ) ; } return view ( 'mustard::listings.list' , [ 'categories' => Category :: roots ( ) -> with ( 'children' ) -> orderBy ( 'sort' , 'asc' ) -> orderBy ( 'name' , 'asc' ) -> get ( ) , 'table' => $ table , 'items' => $ table -> paginate ( ) , 'view_category' => $ category , ] ) ; }
Return the item listings view.

@return \Illuminate\View\View
Return the item listings view .