PHP Class Devise\Search\UniversalSearch

Show file Open project: devisephp/cms

Protected Properties

Property Type Description
$registered array[SearchableInterface] These are all the registered search providers that we will use in our universal search

Public Methods

Method Description
__construct ( Pagination $Pagination ) Create a new universal search
register ( Searchable $item ) : void Provides a way to register new searchable items in our collection of Searchable items
search ( $for, integer $page = 1, integer $perPage = 10 ) : array Search through all registered searchers and put them together in results

Protected Methods

Method Description
searchRegistered ( text $for, integer $limit ) : Collection Search all the registered searchables
searchRegisteredSecondPass ( string $for, integer $limit, integer $leftover, Collection $collection ) : Collection On the second pass it's all about trying to take up as much of the leftovers as you want, like an all you can eat salad bar

Method Details

__construct() public method

Create a new universal search
public __construct ( Pagination $Pagination )
$Pagination Pagination

register() public method

Provides a way to register new searchable items in our collection of Searchable items
public register ( Searchable $item ) : void
$item Searchable
return void

searchRegistered() protected method

Search all the registered searchables
protected searchRegistered ( text $for, integer $limit ) : Collection
$for text
$limit integer
return Collection

searchRegisteredSecondPass() protected method

On the second pass it's all about trying to take up as much of the leftovers as you want, like an all you can eat salad bar
protected searchRegisteredSecondPass ( string $for, integer $limit, integer $leftover, Collection $collection ) : Collection
$for string
$limit integer
$leftover integer
$collection Collection
return Collection

Property Details

$registered protected property

These are all the registered search providers that we will use in our universal search
protected array[SearchableInterface] $registered
return array[SearchableInterface]