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

[2.x] Not filter #72

Merged
merged 3 commits into from
May 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/filtering.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Another available parameter is `filterByOr`, `search` and `searchByOr`.

* **columnName** - (Required) - Name of column you want to filter, for relationships use `dots`.
* **operator** - (Optional | Default: `eq`) Type of operator you want to use.
* **not** - (Optional | Default: `false`) Negate the filter (Accepted values: yes|true|1).
* **not** - (Optional | Default: `false`) Negate the filter (Accepted values: not|yes|true|1).

#### Example filters

Expand Down
1 change: 1 addition & 0 deletions src/Controllers/LaravelController.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ protected function parseFilters(array $filters, $or = false, $defaultOperator =

if (is_array($part)) {
$not = ($arrayCountValues == 2) ? key($part[$operator]) : false;
$not = $not === 'not' ? true : $not;
$not = $not ? filter_var($not, FILTER_VALIDATE_BOOLEAN) : false;

$value = $part[(string)key($part)];
Expand Down