Guest User

Untitled

a guest
Mar 17th, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. 1. install laravel scout.
  2. composer require laravel/scout
  3.  
  4. 2. install tntsearch.
  5. composer require teamtnt/laravel-scout-tntsearch-driver
  6.  
  7. 3. add the ScoutServiceProvider and the TNTSearchScoutServiceProvider to our providers array in config/app.php.
  8. Laravel\Scout\ScoutServiceProvider::class,
  9. TeamTNT\Scout\TNTSearchScoutServiceProvider::class,
  10.  
  11. 4. publish Laravel Scout config file.
  12. php artisan vendor:publish --provider="Laravel\Scout\ScoutServiceProvider"
  13.  
  14. 5. add in .env file
  15. SCOUT_DRIVER=tntsearch
  16.  
  17. 6. add in config/config.php
  18. 'tntsearch' => [
  19. 'storage' => storage_path(),
  20. ],
  21.  
  22. 7. add the Searchable trait on our Model
  23. use Laravel\Scout\Searchable;
  24.  
  25. class Example extends Model
  26. {
  27. use Searchable;
  28. ...........................
  29.  
  30. 8. create the Index file for the first time.
  31. php artisan scout:import "App\Models\Example"
  32.  
  33. 9. use
  34. App\Models\Example::search('search something')->get();
Add Comment
Please, Sign In to add comment