2017 © Pedro Peláez
 

package advancesearch

Fulltext Search for laravel ...

image

5dmatwebsearch/advancesearch

Fulltext Search for laravel ...

  • Friday, February 9, 2018
  • by zizohassan
  • Repository
  • 2 Watchers
  • 34 Stars
  • 702 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 21 Forks
  • 8 Open issues
  • 1 Versions
  • 16 % Grown

The README.md

full-text-search-laravel

Description

Full text search in laravel on single or multiple fields, (*1)

Installation

  composer require 5dmatwebsearch/advancesearch:dev-master

Add service provider (in config/app.php -> 'providers')

   AdvanceSearch\AdvanceSearchProvider\AdvanceSearchProvider::class,

Add aliases (in config/app.php -> 'aliases')

   'Search' => AdvanceSearch\AdvanceSearchProvider\Facades\SearchFacades::class,

Add index

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()

The Versions

09/02 2018

dev-master

9999999-dev

Fulltext Search for laravel ...

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

laravel php search full-text