PHP Trait Nicolaslopezj\Searchable\SearchableTrait

ファイルを表示 Open project: nicolaslopezj/searchable

Protected Properties

Property Type Description
$search_bindings array

Public Methods

Method Description
getTableColumns ( ) : array Returns the table columns.
scopeSearch ( Builder $q, string $search, float | null $threshold = null, boolean $entireText = false, boolean $entireTextOnly = false ) : Builder Creates the search scope.
scopeSearchRestricted ( Builder $q, $search, $restriction, $threshold = null, $entireText = false, $entireTextOnly = false )

Protected Methods

Method Description
addBindingsToQuery ( Builder $query, array $bindings ) Adds the bindings to the query.
addSelectsToQuery ( Builder $query, array $selects ) Puts all the select clauses to the main query.
filterQueryWithRelevance ( Builder $query, array $selects, float $relevance_count ) Adds the relevance filter to the query.
getCaseCompare ( string $column, string $compare, float $relevance ) : string Returns the comparison string.
getColumns ( ) : array Returns the search columns.
getDatabaseDriver ( ) : array Returns database driver Ex: mysql, pgsql, sqlite.
getGroupBy ( ) : array Returns whether or not to keep duplicates.
getJoins ( ) : array Returns the tables that are to be joined.
getSearchQueriesForColumn ( Builder $query, string $column, float $relevance, array $words ) : array Returns the search queries for the specified column.
getSearchQuery ( Builder $query, string $column, string $relevance, array $words, float $relevance_multiplier, string $pre_word = '', string $post_word = '' ) : string Returns the sql string for the given parameters.
makeGroupBy ( Builder $query ) Makes the query not repeat the results.
makeJoins ( Builder $query ) Adds the sql joins to the query.
mergeQueries ( Builder $clone, Builder $original ) Merge our cloned query builder with the original one.

Method Details

addBindingsToQuery() protected method

Adds the bindings to the query.
protected addBindingsToQuery ( Builder $query, array $bindings )
$query Illuminate\Database\Eloquent\Builder
$bindings array

addSelectsToQuery() protected method

Puts all the select clauses to the main query.
protected addSelectsToQuery ( Builder $query, array $selects )
$query Illuminate\Database\Eloquent\Builder
$selects array

filterQueryWithRelevance() protected method

Adds the relevance filter to the query.
protected filterQueryWithRelevance ( Builder $query, array $selects, float $relevance_count )
$query Illuminate\Database\Eloquent\Builder
$selects array
$relevance_count float

getCaseCompare() protected method

Returns the comparison string.
protected getCaseCompare ( string $column, string $compare, float $relevance ) : string
$column string
$compare string
$relevance float
return string

getColumns() protected method

Returns the search columns.
protected getColumns ( ) : array
return array

getDatabaseDriver() protected method

Returns database driver Ex: mysql, pgsql, sqlite.
protected getDatabaseDriver ( ) : array
return array

getGroupBy() protected method

Returns whether or not to keep duplicates.
protected getGroupBy ( ) : array
return array

getJoins() protected method

Returns the tables that are to be joined.
protected getJoins ( ) : array
return array

getSearchQueriesForColumn() protected method

Returns the search queries for the specified column.
protected getSearchQueriesForColumn ( Builder $query, string $column, float $relevance, array $words ) : array
$query Illuminate\Database\Eloquent\Builder
$column string
$relevance float
$words array
return array

getSearchQuery() protected method

Returns the sql string for the given parameters.
protected getSearchQuery ( Builder $query, string $column, string $relevance, array $words, float $relevance_multiplier, string $pre_word = '', string $post_word = '' ) : string
$query Illuminate\Database\Eloquent\Builder
$column string
$relevance string
$words array
$relevance_multiplier float
$pre_word string
$post_word string
return string

getTableColumns() public method

Returns the table columns.
public getTableColumns ( ) : array
return array

makeGroupBy() protected method

Makes the query not repeat the results.
protected makeGroupBy ( Builder $query )
$query Illuminate\Database\Eloquent\Builder

makeJoins() protected method

Adds the sql joins to the query.
protected makeJoins ( Builder $query )
$query Illuminate\Database\Eloquent\Builder

mergeQueries() protected method

Merge our cloned query builder with the original one.
protected mergeQueries ( Builder $clone, Builder $original )
$clone Illuminate\Database\Eloquent\Builder
$original Illuminate\Database\Eloquent\Builder

scopeSearch() public method

Creates the search scope.
public scopeSearch ( Builder $q, string $search, float | null $threshold = null, boolean $entireText = false, boolean $entireTextOnly = false ) : Builder
$q Illuminate\Database\Eloquent\Builder
$search string
$threshold float | null
$entireText boolean
$entireTextOnly boolean
return Illuminate\Database\Eloquent\Builder

scopeSearchRestricted() public method

public scopeSearchRestricted ( Builder $q, $search, $restriction, $threshold = null, $entireText = false, $entireTextOnly = false )
$q Illuminate\Database\Eloquent\Builder

Property Details

$search_bindings protected_oe property

protected array $search_bindings
return array