diff options
author | Sam Light <samlight1994@gmail.com> | 2025-04-26 13:05:25 +0100 |
---|---|---|
committer | Sam Light <samlight1994@gmail.com> | 2025-04-26 13:05:25 +0100 |
commit | 6d26688fded015141a45a88b90b2d70a0ac88420 (patch) | |
tree | 33324531f6e9595c7eb190b89bcdb5a7b55d1b5f /src/Toolbar/Filter.php | |
parent | 88f71aeba1a1649661d713297d3a75454636b2d1 (diff) |
Larastanning
Diffstat (limited to 'src/Toolbar/Filter.php')
-rw-r--r-- | src/Toolbar/Filter.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Toolbar/Filter.php b/src/Toolbar/Filter.php index 51e0d9a..f6777ce 100644 --- a/src/Toolbar/Filter.php +++ b/src/Toolbar/Filter.php @@ -2,6 +2,7 @@ namespace Lightscale\LaralightTables\Toolbar; +use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Builder; use Closure; @@ -26,12 +27,16 @@ abstract class Filter extends Item return "filter_{$this->key}"; } - public function filter(callable $filterCB): static + public function filter(callable $fn): static { - $this->filterCallback = $filterCB; + $this->filterCallback = Closure::fromCallable($fn);; return $this; } + /** + * @template TModel of Model + * @param Builder<TModel> $query + */ public function applyFilter(Builder $query): void { if ($this->filterCallback !== null) { |