original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: Convert the model to Paginator when available or convert it
  to a collection.
  
  @param  mixed  $model
  
  @return \Illuminate\Contracts\Support\Arrayable|array
docstring_tokens: Convert the model to Paginator when available or convert it to a collection .