Tucker-Eric / EloquentFilter

An Eloquent Way To Filter Laravel Models And Their Relationships
http://tucker-eric.github.io/EloquentFilter
MIT License
1.72k stars 120 forks source link

Access the other request parameters within the filter function? #167

Closed yaman3bd closed 2 years ago

yaman3bd commented 2 years ago

is it possible to access the other request parameters within the filter function? because I am working on filtering the data in a way like:

{
 products: [id, id, id],
 operator: '='
}

so in my products function, I want to be able to use the operator parameter as well because the operator is changeable it could be'!=' or '='

is it possible to access the other request parameters within the products function?

it would be amazing if it could be something like this: image

However, I thought of this idea I do not know if it is right or not

image

Tucker-Eric commented 2 years ago

Yep! You can access it with the input() method.

You'd access it in your method via:

$operator = $this->input('operator');
yaman3bd commented 2 years ago

@Tucker-Eric solved the problem! thanks a lot