Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter by range #4

Closed
4ndro1d opened this issue Oct 21, 2016 · 1 comment
Closed

Filter by range #4

4ndro1d opened this issue Oct 21, 2016 · 1 comment
Labels

Comments

@4ndro1d
Copy link

4ndro1d commented Oct 21, 2016

How can I achieve a filter with 2 values (e.g. price):

I want to filter results by a minimum and/or maximum price:
My model has a 'price' column, from my form I get 'min_price' and 'max_price', which is appended to the URL.

Sorry for bothering again ;D

@mnabialek
Copy link
Owner

You need to create custom methods in your filter to handle this for example:

protected function applyMinPrice($value)
{
    $this->query->where('price ','>=', $value);
}
protected function applyMaxPrice($value)
{
    $this->query->where('price ','<=', $value);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants