I am trying to run the command php artisan scout:import "App\User" to import user records into search driver as per documentation (Laravel 5.3 Scout Documentation). I keep getting [BadMethodCallException]
Call to undefined method Illuminate\Database\Query\Builder::makeAllSearchable()
as an error. Why am I getting this error? I have included the searchable trait in my users controller and added the scout class to my app/config providers array, so I am struggling to see why the method doesn't exist...
0
votes
2 Answers
2
votes
2
votes
Like Jakub has said, you have to add the Searchable trait to your User model, not to the controller.
If you're using toSearchableArray() on your model, do not forget to include the id column in the array, otherwise it won't work.
You could also comment the toSearchableArray() function, import the existing users and then add it back.