Download the PHP package nemrutco/nova-global-filter without Composer
On this page you can find all versions of the php package nemrutco/nova-global-filter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package nova-global-filter
Nova Global Filter
This package allows you to emit any of your existing Laravel Nova filters to metrics or custom cards.
Installation
You can install the package in to a Laravel
app that uses Nova via composer:
Usage
In this example, we are registering few Metric Cards
and the Global Filter
with a Date
filter as:
And now metric cards
or any other cards
optimized to listen GlobalFilter
can be filtered by using GlobalFilterable
trait and calling $this->globalFiltered($model,$filters)
method.
globalFiltered($model, $filters = [])
method expect $model
and $filters
parameters:
And that's it. Cards will be filtered based on passed filter value.
If you want to apply default value on initial request make sure you set default value in your filter as
To change layout from grid
to inline
by default it's set to grid
To enable Reset
button
To add multiple Global Filter
s
To set Title
of Global Filter
To listen Global Filter
on any Custom Card
s:
To request all filter states from Global Filter
on any Custom Card
s:
To request spesific filters state from Global Filter
on any Custom Card
s:
To receive filters state from Global Filter
on any Custom Card
s:
Good to know
- Basic functionality of this package is that it listens all the asigned filters. Once a value of a filter is changed, it emits as
Nova.$on('global-filter-changed', [changed filter and value])
. So any card that listens to this event will recieve the filter and its value. - This package overwrites Nova's default
Metric Card
s to allow them to listen"global-filter-changed"
event. Make sure there are no any conflicts with other pacages. - This package currently does not support Index view filters to be synchronized. So filters in
Global Filter
will not trigger update at the filters inFilter Menu
of your Index view. Reset
button simply reloads the current page. There is nothing fancy going on behind the scenes.- If you are willing to support this package, it will be great to get your issues, PRs and thoughts on Github. And dont forget to
Star
the package.
Cheers
Made with ❤️ for open source
- Nemrut Creative Studio
- Muzaffer Dede
- All Contributors
License
The MIT License (MIT). Please see License File for more information.