Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1. install laravel scout.
- composer require laravel/scout
- 2. install tntsearch.
- composer require teamtnt/laravel-scout-tntsearch-driver
- 3. add the ScoutServiceProvider and the TNTSearchScoutServiceProvider to our providers array in config/app.php.
- Laravel\Scout\ScoutServiceProvider::class,
- TeamTNT\Scout\TNTSearchScoutServiceProvider::class,
- 4. publish Laravel Scout config file.
- php artisan vendor:publish --provider="Laravel\Scout\ScoutServiceProvider"
- 5. add in .env file
- SCOUT_DRIVER=tntsearch
- 6. add in config/config.php
- 'tntsearch' => [
- 'storage' => storage_path(),
- ],
- 7. add the Searchable trait on our Model
- use Laravel\Scout\Searchable;
- class Example extends Model
- {
- use Searchable;
- ...........................
- 8. create the Index file for the first time.
- php artisan scout:import "App\Models\Example"
- 9. use
- App\Models\Example::search('search something')->get();
Add Comment
Please, Sign In to add comment