Property | Type | Description | |
---|---|---|---|
$relations | array | Related Models that have ModelFilters as well as the method on the ModelFilter As [relatedModel => [input_key1, input_key2]]. |
Property | Type | Description | |
---|---|---|---|
$allRelations | array | Container for all relations (local and related ModelFilters). | |
$drop_id | boolean | Drop _id from the end of input keys when referencing methods. | |
$input | array | Array of input to filter. | |
$localRelatedFilters | array | (This allows us to not be required to define a filter for the related models). | |
$query | |||
$relationsEnabled | boolean | This is to be able to bypass relations if we are filtering a joined table. |
Method | Description | |
---|---|---|
__call ( $method, $args ) | Handle calling methods on the query object. | |
__construct ( $query, array $input = [], boolean $relationsEnabled = true ) | ModelFilter constructor. | |
addRelated ( $relation, Closure $closure ) | Locally defines a relation filter method that will be called in the context of the related model. | |
callRelatedLocalSetup ( $related, $query ) | ||
disableRelations ( ) | Disable querying relations (Mainly for joined tables as the related model isn't queried). | |
dropIdSuffix ( null $bool = null ) : boolean | Set to drop _id from input. Mainly for testing. | |
enableRelations ( ) | Enable querying relations. | |
filterInput ( ) | Filter with input array. | |
filterJoinedRelation ( $related ) | Run the filter on models that already have their tables joined. | |
filterRelations ( ) | Filter relationships defined in $this->relations array. | |
filterUnjoinedRelation ( $related ) | Filters by a relationship that isn't joined by using that relation's ModelFilter. | |
getAllRelations ( ) : array | Returns all local relations and relations requiring other Model's Filter's. | |
getFilterMethod ( $key ) : string | ||
getJoinedTables ( ) : array | Gets all the joined tables. | |
getLocalRelation ( string $related ) : array | ||
getRelatedFilter ( $relation ) : mixed | Get the model filter of a related model. | |
getRelatedFilterInput ( $related ) : array | Get input to pass to a related Model's Filter. | |
getRelatedModel ( $relation ) : |
Get an empty instance of a related model. | |
getRelatedTable ( $relation ) : string | Get the table name from a relationship. | |
getRelationConstraints ( string $relation ) : array | Get all input to pass through related filters and local closures as an array. | |
handle ( ) : |
Handle all filters. | |
input ( null $key = null, null $default = null ) : array | mixed | null | Retrieve input by key or all input as array. | |
push ( $key, null $value = null ) | Add values to filter by if called in setup(). | |
related ( $relation, $column, null $operator = null, null $value = null, string $boolean = 'and' ) | Add a where constraint to a relationship. | |
relationIsFilterable ( $relation ) : boolean | Check to see if there is input or locally defined methods for the given relation. | |
relationIsJoined ( $relation ) : boolean | Checks if the relation to filter's table is already joined. | |
relationIsLocal ( $related ) : boolean | Checks to see if there are locally defined relations to filter. | |
relationUsesFilter ( $related ) : boolean | Checks if there is input that should be passed to a related Model Filter. | |
relationsEnabled ( ) : boolean | Checks if filtering by relations is enabled. | |
removeEmptyInput ( array $input ) : array | Remove empty strings from the input array. |
public __call ( $method, $args ) | ||
$method | ||
$args |
public __construct ( $query, array $input = [], boolean $relationsEnabled = true ) | ||
$query | ||
$input | array | |
$relationsEnabled | boolean |
public addRelated ( $relation, Closure $closure ) | ||
$relation | ||
$closure | Closure |
public disableRelations ( ) |
public dropIdSuffix ( null $bool = null ) : boolean | ||
$bool | null | |
return | boolean |
public filterJoinedRelation ( $related ) | ||
$related |
public filterRelations ( ) |
public filterUnjoinedRelation ( $related ) | ||
$related |
public getAllRelations ( ) : array | ||
return | array |
public getJoinedTables ( ) : array | ||
return | array |
public getLocalRelation ( string $related ) : array | ||
$related | string | |
return | array |
public getRelatedFilter ( $relation ) : mixed | ||
$relation | ||
return | mixed |
public getRelatedFilterInput ( $related ) : array | ||
$related | ||
return | array |
public getRelatedModel ( $relation ) : |
||
$relation | ||
return |
public getRelatedTable ( $relation ) : string | ||
$relation | ||
return | string |
public getRelationConstraints ( string $relation ) : array | ||
$relation | string | |
return | array |
public handle ( ) : |
||
return |
public relationIsFilterable ( $relation ) : boolean | ||
$relation | ||
return | boolean |
public relationIsJoined ( $relation ) : boolean | ||
$relation | ||
return | boolean |
public relationIsLocal ( $related ) : boolean | ||
$related | ||
return | boolean |
public relationUsesFilter ( $related ) : boolean | ||
$related | ||
return | boolean |
public relationsEnabled ( ) : boolean | ||
return | boolean |
public removeEmptyInput ( array $input ) : array | ||
$input | array | |
return | array |
protected array $allRelations | ||
return | array |
protected bool $drop_id | ||
return | boolean |
protected array $localRelatedFilters | ||
return | array |
protected Builder,Illuminate\Database\Eloquent $query | ||
return |
public array $relations | ||
return | array |
protected bool $relationsEnabled | ||
return | boolean |