protected function buildModel($model)
    {
        try {
            $query = $this->resolveQueryBuilderFromModel($model);
        } catch (InvalidArgumentException $e) {
            $query = $model;
        }

        if ($this->paginate === true && \method_exists($query, 'paginate')) {
            $query = $query->paginate($this->perPage, ['*'], $this->pageName);
        } elseif ($this->isQueryBuilder($query)) {
            $query = $query->get();
        }

        return $query;
    }
protected function buildModel($model)
    {
        try {
            $query = $this->resolveQueryBuilderFromModel($model);
        } catch (InvalidArgumentException $e) {
            $query = $model;
        }

        if ($this->paginate === true && \method_exists($query, 'paginate')) {
            $query = $query->paginate($this->perPage, ['*'], $this->pageName);
        } elseif ($this->isQueryBuilder($query)) {
            $query = $query->get();
        }

        return $query;
    }
protected function buildModel ( $ model ) { try { $ query = $ this -> resolveQueryBuilderFromModel ( $ model ) ; } catch ( InvalidArgumentException $ e ) { $ query = $ model ; } if ( $ this -> paginate === true && \ method_exists ( $ query , 'paginate' ) ) { $ query = $ query -> paginate ( $ this -> perPage , [ '*' ] , $ this -> pageName ) ; } elseif ( $ this -> isQueryBuilder ( $ query ) ) { $ query = $ query -> get ( ) ; } return $ query ; }
Convert the model to Paginator when available or convert it
to a collection.

@param  mixed  $model

@return \Illuminate\Contracts\Support\Arrayable|array
Convert the model to Paginator when available or convert it to a collection .