PHP Trait EloquentFilter\Filterable

Mostra file Open project: tucker-eric/eloquentfilter

Protected Properties

Property Type Description
$filter
$filtered array Array of input used to filter the query.

Public Methods

Method Description
getModelFilterClass ( ) : ModelFilter Returns the ModelFilter for the current model.
provideFilter ( null | string $filter = null ) : ModelFilter Returns ModelFilter class to be instantiated.
scopeFilter ( $query, array $input = [], null | string | ModelFilter $filter = null ) : Builder Creates local scope to run the filter.
scopePaginateFilter ( $query, integer $perPage = null, array $columns = ['*'], string $pageName = 'page', integer | null $page = null ) : Illuminate\Contracts\Pagination\LengthAwarePaginator Paginate the given query with url query params appended.
scopeSimplePaginateFilter ( $query, integer $perPage = null, array $columns = ['*'], string $pageName = 'page' ) : Illuminate\Contracts\Pagination\LengthAwarePaginator Paginate the given query with url query params appended.
scopeWhereBeginsWith ( $query, $column, $value, string $boolean = 'and' ) : mixed WHERE $column LIKE $value% query.
scopeWhereEndsWith ( $query, $column, $value, string $boolean = 'and' ) : mixed WHERE $column LIKE %$value query.
scopeWhereLike ( $query, $column, $value, string $boolean = 'and' ) : mixed WHERE $column LIKE %$value% query.

Method Details

getModelFilterClass() public method

Returns the ModelFilter for the current model.
public getModelFilterClass ( ) : ModelFilter
return ModelFilter

provideFilter() public method

Returns ModelFilter class to be instantiated.
public provideFilter ( null | string $filter = null ) : ModelFilter
$filter null | string
return ModelFilter

scopeFilter() public method

Creates local scope to run the filter.
public scopeFilter ( $query, array $input = [], null | string | ModelFilter $filter = null ) : Builder
$query
$input array
$filter null | string | ModelFilter
return Illuminate\Database\Eloquent\Builder

scopePaginateFilter() public method

Paginate the given query with url query params appended.
public scopePaginateFilter ( $query, integer $perPage = null, array $columns = ['*'], string $pageName = 'page', integer | null $page = null ) : Illuminate\Contracts\Pagination\LengthAwarePaginator
$perPage integer
$columns array
$pageName string
$page integer | null
return Illuminate\Contracts\Pagination\LengthAwarePaginator

scopeSimplePaginateFilter() public method

Paginate the given query with url query params appended.
public scopeSimplePaginateFilter ( $query, integer $perPage = null, array $columns = ['*'], string $pageName = 'page' ) : Illuminate\Contracts\Pagination\LengthAwarePaginator
$perPage integer
$columns array
$pageName string
return Illuminate\Contracts\Pagination\LengthAwarePaginator

scopeWhereBeginsWith() public method

WHERE $column LIKE $value% query.
public scopeWhereBeginsWith ( $query, $column, $value, string $boolean = 'and' ) : mixed
$query
$column
$value
$boolean string
return mixed

scopeWhereEndsWith() public method

WHERE $column LIKE %$value query.
public scopeWhereEndsWith ( $query, $column, $value, string $boolean = 'and' ) : mixed
$query
$column
$value
$boolean string
return mixed

scopeWhereLike() public method

WHERE $column LIKE %$value% query.
public scopeWhereLike ( $query, $column, $value, string $boolean = 'and' ) : mixed
$query
$column
$value
$boolean string
return mixed

Property Details

$filter protected_oe property

protected $filter

$filtered protected_oe property

Array of input used to filter the query.
protected array $filtered
return array