src/mako/database/query/Query.php
public function paginate(?int $itemsPerPage = null, array $options = [])
	{
		$count = $this->paginationCount();

		$pagination = static::getPaginationFactory()->create($count, $itemsPerPage, $options);

		if($count > 0)
		{
			$results = $this->limit($pagination->limit())->offset($pagination->offset())->all();
		}
		else
		{
			$results = $this->createResultSet([]);
		}

		$results->setPagination($pagination);

		return $results;
	}
public function paginate(?int $itemsPerPage = null, array $options = [])
	{
		$count = $this->paginationCount();

		$pagination = static::getPaginationFactory()->create($count, $itemsPerPage, $options);

		if($count > 0)
		{
			$results = $this->limit($pagination->limit())->offset($pagination->offset())->all();
		}
		else
		{
			$results = $this->createResultSet([]);
		}

		$results->setPagination($pagination);

		return $results;
	}
public function paginate ( ? int $ itemsPerPage = null , array $ options = [ ] ) { $ count = $ this -> paginationCount ( ) ; $ pagination = static :: getPaginationFactory ( ) -> create ( $ count , $ itemsPerPage , $ options ) ; if ( $ count > 0 ) { $ results = $ this -> limit ( $ pagination -> limit ( ) ) -> offset ( $ pagination -> offset ( ) ) -> all ( ) ; } else { $ results = $ this -> createResultSet ( [ ] ) ; } $ results -> setPagination ( $ pagination ) ; return $ results ; }
Paginates the results using a pagination instance.

@param  int|null                       $itemsPerPage Number of items per page
@param  array                          $options      Pagination options
@return \mako\database\query\ResultSet
Paginates the results using a pagination instance .