Laravel Scout is now open for developer testing
Published on by Eric L. Barnes
Laravel Scout is a driver based full-text search for Eloquent that is going to be available when Laravel 5.3 launches.
The driver is not officially released yet, however, the repository is now live and available for those that want to play with more engines.
For those not familiar with Scout it is an optional package that makes full-text searching simple.
Scout works by implementing a “Searchable” trait with your existing models. Then it’s just a matter of syncing the data with the search service like this:
php artisan scout:import App\\Post
After that you can search your models with:
You can even paginate:
And it even includes simple where clauses:
Post::search(‘Alice’)—>where('acount_id', '>', 1)->paginate()
The repository has already had a few pull requests for adding additional search engines and Taylor is recommending developers create their own packages like what is being done with Laravel Notifications.
Once 5.3 is official the documentation for Scout will be available and it’ll be ready for all.