public function index()
    {
        // For single-item display only, redirect to the relevant show/edit page
        if ($this->modelInformation->single) {
            return $this->returnViewForSingleDisplay();
        }

        $this->resetStateBeforeIndexAction()
             ->checkListParents()
             ->applyListParentContext()
             ->checkActiveSort()
             ->checkScope()
             ->checkFilters()
             ->checkActivePage();

        $totalCount  = $this->getTotalCount();
        $scopeCounts = $this->getScopeCounts();

        $this->applySort()
             ->applyScope($this->modelRepository);

        $query = $this->getModelRepository()->query();

        $this->applyFilter($query)
             ->applyListParentToQuery($query);

        $records = $query->paginate($this->getActualPageSize(), ['*'], 'page', $this->getActualPage());

        // Check and whether page is out of bounds and adjust
        if ($this->getActualPage() > $records->lastPage()) {
            $records = $query->paginate($this->getActualPageSize(), ['*'], 'page', $records->lastPage());
        }

        $currentCount = method_exists($records, 'total') ? $records->total() : 0;

        return view($this->getIndexView(), [
            'moduleKey'           => $this->moduleKey,
            'routePrefix'         => $this->routePrefix,
            'permissionPrefix'    => $this->permissionPrefix,
            'model'               => $this->modelInformation,
            'records'             => $records,
            'recordReferences'    => $this->getReferenceRepository()->getReferencesForModels($records->items()),
            'totalCount'          => $totalCount,
            'currentCount'        => $currentCount,
            'listStrategies'      => $this->getListColumnStrategyInstances(),
            'sortColumn'          => $this->getActualSort(),
            'sortDirection'       => $this->getActualSortDirection(),
            'pageSize'            => $this->getActualPageSize(),
            'pageSizeOptions'     => $this->getPageSizeOptions(),
            'filterStrategies'    => $this->renderedListFilterStrategies($this->getActiveFilters()),
            'activeScope'         => $this->getActiveScope(),
            'scopeCounts'         => $scopeCounts,
            'unconditionalDelete' => $this->isUnconditionallyDeletable(),
            'defaultRowAction'    => $this->getDefaultRowActionInstance(),
            'hasActiveListParent' => (bool) $this->listParentRelation,
            'listParents'         => $this->listParents,
            'topListParentOnly'   => $this->showsTopParentsOnly(),
            'draggableOrderable'  => $this->isListOrderDraggable($totalCount, $currentCount),
            'availableExportKeys' => $this->getAvailableExportStrategyKeys(),
        ]);
    }
public function index()
    {
        // For single-item display only, redirect to the relevant show/edit page
        if ($this->modelInformation->single) {
            return $this->returnViewForSingleDisplay();
        }

        $this->resetStateBeforeIndexAction()
             ->checkListParents()
             ->applyListParentContext()
             ->checkActiveSort()
             ->checkScope()
             ->checkFilters()
             ->checkActivePage();

        $totalCount  = $this->getTotalCount();
        $scopeCounts = $this->getScopeCounts();

        $this->applySort()
             ->applyScope($this->modelRepository);

        $query = $this->getModelRepository()->query();

        $this->applyFilter($query)
             ->applyListParentToQuery($query);

        $records = $query->paginate($this->getActualPageSize(), ['*'], 'page', $this->getActualPage());

        // Check and whether page is out of bounds and adjust
        if ($this->getActualPage() > $records->lastPage()) {
            $records = $query->paginate($this->getActualPageSize(), ['*'], 'page', $records->lastPage());
        }

        $currentCount = method_exists($records, 'total') ? $records->total() : 0;

        return view($this->getIndexView(), [
            'moduleKey'           => $this->moduleKey,
            'routePrefix'         => $this->routePrefix,
            'permissionPrefix'    => $this->permissionPrefix,
            'model'               => $this->modelInformation,
            'records'             => $records,
            'recordReferences'    => $this->getReferenceRepository()->getReferencesForModels($records->items()),
            'totalCount'          => $totalCount,
            'currentCount'        => $currentCount,
            'listStrategies'      => $this->getListColumnStrategyInstances(),
            'sortColumn'          => $this->getActualSort(),
            'sortDirection'       => $this->getActualSortDirection(),
            'pageSize'            => $this->getActualPageSize(),
            'pageSizeOptions'     => $this->getPageSizeOptions(),
            'filterStrategies'    => $this->renderedListFilterStrategies($this->getActiveFilters()),
            'activeScope'         => $this->getActiveScope(),
            'scopeCounts'         => $scopeCounts,
            'unconditionalDelete' => $this->isUnconditionallyDeletable(),
            'defaultRowAction'    => $this->getDefaultRowActionInstance(),
            'hasActiveListParent' => (bool) $this->listParentRelation,
            'listParents'         => $this->listParents,
            'topListParentOnly'   => $this->showsTopParentsOnly(),
            'draggableOrderable'  => $this->isListOrderDraggable($totalCount, $currentCount),
            'availableExportKeys' => $this->getAvailableExportStrategyKeys(),
        ]);
    }
public function index ( ) { // For single-item display only, redirect to the relevant show/edit page if ( $ this -> modelInformation -> single ) { return $ this -> returnViewForSingleDisplay ( ) ; } $ this -> resetStateBeforeIndexAction ( ) -> checkListParents ( ) -> applyListParentContext ( ) -> checkActiveSort ( ) -> checkScope ( ) -> checkFilters ( ) -> checkActivePage ( ) ; $ totalCount = $ this -> getTotalCount ( ) ; $ scopeCounts = $ this -> getScopeCounts ( ) ; $ this -> applySort ( ) -> applyScope ( $ this -> modelRepository ) ; $ query = $ this -> getModelRepository ( ) -> query ( ) ; $ this -> applyFilter ( $ query ) -> applyListParentToQuery ( $ query ) ; $ records = $ query -> paginate ( $ this -> getActualPageSize ( ) , [ '*' ] , 'page' , $ this -> getActualPage ( ) ) ; // Check and whether page is out of bounds and adjust if ( $ this -> getActualPage ( ) > $ records -> lastPage ( ) ) { $ records = $ query -> paginate ( $ this -> getActualPageSize ( ) , [ '*' ] , 'page' , $ records -> lastPage ( ) ) ; } $ currentCount = method_exists ( $ records , 'total' ) ? $ records -> total ( ) : 0 ; return view ( $ this -> getIndexView ( ) , [ 'moduleKey' => $ this -> moduleKey , 'routePrefix' => $ this -> routePrefix , 'permissionPrefix' => $ this -> permissionPrefix , 'model' => $ this -> modelInformation , 'records' => $ records , 'recordReferences' => $ this -> getReferenceRepository ( ) -> getReferencesForModels ( $ records -> items ( ) ) , 'totalCount' => $ totalCount , 'currentCount' => $ currentCount , 'listStrategies' => $ this -> getListColumnStrategyInstances ( ) , 'sortColumn' => $ this -> getActualSort ( ) , 'sortDirection' => $ this -> getActualSortDirection ( ) , 'pageSize' => $ this -> getActualPageSize ( ) , 'pageSizeOptions' => $ this -> getPageSizeOptions ( ) , 'filterStrategies' => $ this -> renderedListFilterStrategies ( $ this -> getActiveFilters ( ) ) , 'activeScope' => $ this -> getActiveScope ( ) , 'scopeCounts' => $ scopeCounts , 'unconditionalDelete' => $ this -> isUnconditionallyDeletable ( ) , 'defaultRowAction' => $ this -> getDefaultRowActionInstance ( ) , 'hasActiveListParent' => ( bool ) $ this -> listParentRelation , 'listParents' => $ this -> listParents , 'topListParentOnly' => $ this -> showsTopParentsOnly ( ) , 'draggableOrderable' => $ this -> isListOrderDraggable ( $ totalCount , $ currentCount ) , 'availableExportKeys' => $ this -> getAvailableExportStrategyKeys ( ) , ] ) ; }
Returns listing of filtered, sorted records.

@return mixed
Returns listing of filtered sorted records .