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.
Join the weekly newsletter and never miss out on new tips, tutorials, and more.
- SENIOR FULL STACK SOFTWARE ENGINEER
Fort Worth, Texas
- PHP Web Developer
Christ for all Nations
- PHP Developer
Manhattan, KS (open to Remote)
- Mid-Senior Laravel Developer
- Full Stack Web Developer
Las Vegas, NV
- Staff Software Engineer (Laravel)
- Software Engineer (PHP, Laravel, Vue)
Los Angeles, CA
How to use WordPress as a backend for a Laravel Application
Last week I relaunched Laravel News, and the new site is running on Laravel with WordPress as the backend. I’ve been…
A Quick Guide to Choosing Tools (Sponsor)
What separates the wrong analytics tool from the right one? It’s easy enough to figure out — if you understand…