Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

chris3423's avatar

Query Builder - Paginate AND add custom text to query

I have a problem with the query builder. I use it to make some queries for a Sphinx search. The problem: I want to use the paginate feature but add an option at the end of the query:

option max_matches=10000

So the query should be SELECT (...) LIMIT 0,100 option max_matches=10000

Is there a way to do that?

0 likes
3 replies
Vilfago's avatar

What is your current code ?

I guess the option should be before the paginate.

chris3423's avatar

$r['results'] = $con->table(DB::raw($register_query))->select('*')->whereRaw("id IN (".implode($tms, ',').")")->orderByRaw($order.' '.$sort.' ')->paginate(100)->withPath($url.'?order='.$order.'&sort='.$sort);

Sphinx expects the option after the LIMIT

Vilfago's avatar

I don't see the options in your query.

You can maybe create your own pagination with take() and skip().

Please or to participate in this conversation.