Download the PHP package vpominchuk/laravel-mysql-use-index-scope without Composer
On this page you can find all versions of the php package vpominchuk/laravel-mysql-use-index-scope. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vpominchuk/laravel-mysql-use-index-scope
More information about vpominchuk/laravel-mysql-use-index-scope
Files in vpominchuk/laravel-mysql-use-index-scope
Package laravel-mysql-use-index-scope
Short Description A super simple package allowing for use MySQL `USE INDEX` and `FORCE INDEX` statements
License MIT
Homepage https://github.com/vpominchuk/laravel-mysql-use-index-scope
Informations about the package laravel-mysql-use-index-scope
Laravel MySQL Use Index Scope
A super simple package allowing for use MySQL USE INDEX
and FORCE INDEX
statements.
Requirements
- PHP
^7.4 | ^8.0
- Laravel 6, 7, 8, 9, 10, and 11
Installation
composer require vpominchuk/laravel-mysql-use-index-scope
Usage
Simply reference the required trait in your model:
Model:
Anywhere in the code:
Database table structure:
You need to create a named index with required name. For example:
Laravel Migration:
Available methods
useIndex($indexName)
Tells MySQL to use an index if it possible.
forceIndex($indexName)
Force MySQL to use an index if it possible.
ignoreIndex($indexName)
Ask MySQL to ignore an index if it possible.
Security
If you discover any security related issues, please use the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.