You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there any way to change this package to work with the DB:: query builder? for example the query below: DB::select("select name from users USE INDEX (names) limit 10");
being written like: DB::table('users')->select('name')->useIndex('names')->limit(10);
The text was updated successfully, but these errors were encountered:
@omidMolaverdi put this in your AppServiceProvider to use it anywhere 👍
Builder::macro('useIndex', function (string$indexName) {
$tableName = $this->getQuery()->from;
$this->getQuery()->from(\DB::raw("{$tableName} USE INDEX ({$indexName})"));
return$this;
});
Thanks for the great work.
Is there any way to change this package to work with the DB:: query builder? for example the query below:
DB::select("select name from users USE INDEX (names) limit 10");
being written like:
DB::table('users')->select('name')->useIndex('names')->limit(10);
The text was updated successfully, but these errors were encountered: