⚠️ Deprecated: Laravel scout now supports database and collection drivers for testing purpose
Database driver for Laravel scout.
Of-course search engines like algolia are faster and more accurate.
But you can use database driver for these purposes.
- You don't want to spend money on services like algolia now but you want your web app be flexible to use a search engine in future!
- You want to test your app in local environment without running a search engine on your local machine or use a online search engine service.
You can install the package via composer:
composer require sanjabteam/laravel-scout-database-driver
- Requirements
- Laravel 8 >=
- Laravel Scout 8 >=
Run migrations:
php artisan migrate
And change scout default driver.
You should change your default scout driver to database
.
.env:
SCOUT_DRIVER=database
-- Or --
config/scout.php:
'driver' => 'database',
Add database specific configurations at end of scout config file.
config/scout.php:
<?php
return [
// ...
'driver' => ...
// ..
'database' => [
// All optional database configurations here
'connection' => ...,
'mode' => ...,
],
];
All following configurations are optional
scout.database.connection
:
Database connection to store search data. Change this if you don't want use your default database for search data.
scout.database.mode
:
Search mode.
Possible values:
LIKE
More strict, fasterLIKE_EXPANDED
Less strict, slower
scout.database.relevance
:
Relevance value for search query.
Check the source code to understand above configurations.
- Order is not supported.
Contributions are welcome!
- Fork the Project
- Clone your project (git clone https://github.com/your_username/laravel-scout-database-driver.git)
- Create new branch (git checkout -b your_feature)
- Commit your Changes (git commit -m 'new feature')
- Push to the Branch (git push origin your_feature)
- Open a Pull Request
![](https://raw.githubusercontent.com/amir9480/amir9480/master/donate.png)
The MIT License (MIT). Please see License File for more information.