public function paginate($perPage = 15, $columns = array('*'), $pageName = 'page', $page = null)
    {
        if (is_null($page)) {
            $page = Paginator::resolveCurrentPage($pageName);
        }

        $path = Paginator::resolveCurrentPath($pageName);

        //
        $total = $this->getPaginationCount();

        if ($total > 0) {
            $results = $this->forPage($page, $perPage)->get($columns);
        } else {
            $results = collect();
        }

        return new Paginator($results, $total, $perPage, $page, compact('path', 'pageName'));
    }
public function paginate($perPage = 15, $columns = array('*'), $pageName = 'page', $page = null)
    {
        if (is_null($page)) {
            $page = Paginator::resolveCurrentPage($pageName);
        }

        $path = Paginator::resolveCurrentPath($pageName);

        //
        $total = $this->getPaginationCount();

        if ($total > 0) {
            $results = $this->forPage($page, $perPage)->get($columns);
        } else {
            $results = collect();
        }

        return new Paginator($results, $total, $perPage, $page, compact('path', 'pageName'));
    }
public function paginate ( $ perPage = 15 , $ columns = array ( '*' ) , $ pageName = 'page' , $ page = null ) { if ( is_null ( $ page ) ) { $ page = Paginator :: resolveCurrentPage ( $ pageName ) ; } $ path = Paginator :: resolveCurrentPath ( $ pageName ) ; // $ total = $ this -> getPaginationCount ( ) ; if ( $ total > 0 ) { $ results = $ this -> forPage ( $ page , $ perPage ) -> get ( $ columns ) ; } else { $ results = collect ( ) ; } return new Paginator ( $ results , $ total , $ perPage , $ page , compact ( 'path' , 'pageName' ) ) ; }
Paginate the given query into a paginator.

@param  int  $perPage
@param  array  $columns
@param  string  $pageName
@param  int|null  $page
@return \Nova\Pagination\Paginator
Paginate the given query into a paginator .