Skip to content

Commit

Permalink
Merge pull request #2 from lchris44/lchris44-added-functionality-for-…
Browse files Browse the repository at this point in the history
…filterDisplay-menu

Added functionality to support also filterDisplay=menu
  • Loading branch information
coolsam726 authored Nov 22, 2021
2 parents d878d6c + e20347a commit 8199ae6
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/PrimevueDatatables.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,18 @@ public function make(): \Illuminate\Contracts\Pagination\LengthAwarePaginator
})->where(function (Builder $q) use ($localFilters) {
// Local filters
foreach ($localFilters as $field => $filter) {
if (collect($filter)->get("value")) {
$instance = new Filter($field, collect($filter)->get("value"), collect($filter)->get("matchMode"));
$this->applyFilter($instance, $q);
if(isset($filter['constraints'])){
foreach($filter['constraints'] as $const){
if ($const["value"]) {
$instance = new Filter($field, $const["value"], $const["matchMode"]);
$this->applyFilter($instance, $q, $filter['operator'] == 'or' ? true : false);
}
}
} else {
if (collect($filter)->get("value")) {
$instance = new Filter($field, collect($filter)->get("value"), collect($filter)->get("matchMode"));
$this->applyFilter($instance, $q);
}
}
}
});
Expand Down

0 comments on commit 8199ae6

Please sign in to comment.