dev-master
9999999-devFulltext Search for laravel ...
MIT
The Requires
- php >=5.4.0
laravel php search full-text
Fulltext Search for laravel ...
Full text search in laravel on single or multiple fields, (*1)
composer require 5dmatwebsearch/advancesearch:dev-master
AdvanceSearch\AdvanceSearchProvider\AdvanceSearchProvider::class,
'Search' => AdvanceSearch\AdvanceSearchProvider\Facades\SearchFacades::class,
Add index to fields, (*2)
php artisan index:table table fields
table = the table name
fields = the fields you can add. One or more fields can be added like this: title,description,tags, (*3)
Example, (*4)
php artisan index:table films title,description
You can now use the search function, (*5)
Search::search(modelName , fields, searchText ,select , order , pagination , limit)
modelName = The table name
fields = The fields you can add title,description,tags
searchText = The text you're looking for
select = The fields you want a return from. You can return with one field like this: title. Or more than one like ['title' , 'description']
order = You can pass a single order field like this: id. Or you can pass the field and the way like this ['id' , 'desc']
pagination = True if you want pagination to be enabled, false if not. The package will paginate by default
limit = The amount of results you want returned. (10 by default)
, (*6)
First example with pagination, (*7)
Search::search( "Films" , ['title' , 'description'] , "Drama Outback GOLDFINGER" , ['modelName' , 'title', 'description'], ['film_id' , 'asc'] , true , 30 )
Second example with pagination, (*8)
Search::search( "Films" , ['title' , 'description'] , "Drama Outback GOLDFINGER" , ['id' , 'title', 'description'], 'film_id' )
Example without pagination, (*9)
Search::search( "Films" , ['title' , 'description'] , "Drama Outback GOLDFINGER" , ['film_id' , 'title', 'description'], 'film_id', false )->where('film_id' , 10)->get()
Fulltext Search for laravel ...
MIT
laravel php search full-text