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

hameti's avatar

Add ->index to the DB query builder

First, thanks for the fantastic framework.

I am thinking of using a specific index in the DB:: query builder and searching the options in the DB:: class but it seems that there is no ->index or ->useIndex in the options. Is there any way that I add it as an (optional) option to DB query builder?

0 likes
5 replies
hameti's avatar

@Sinnbeck

this is an example of raw query: DB::select("select name from users USE INDEX (names) limit 10");

and I would love to write it like DB::table('users')->select('name')->useIndex('names')->limit(10);

Please or to participate in this conversation.