sanjabteam / laravel-scout-database-driver
Laravel scout database driver.
Fund package maintenance!
github.com/amir9480/amir9480/blob/master/donation.md
Requires
- php: ^7.3|^8
- illuminate/database: ^8
- illuminate/support: ^8
- laravel/scout: ^8.6
Requires (Dev)
This package is auto-updated.
Last update: 2022-06-17 15:45:00 UTC
README
⚠️ Deprecated: Laravel scout now supports database and collection drivers for testing purpose
Laravel Scout Database Driver
Database driver for Laravel scout.
Why?
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.
Installation
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.
Configuration
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.
Limits
- Order is not supported.
Contributing
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
Donation
License
The MIT License (MIT). Please see License File for more information.