simplesquid / nova-enum-field

An enum field and filters for Laravel Nova.
MIT License
52 stars 26 forks source link

Default filter value #32

Closed ImJustToNy closed 3 years ago

ImJustToNy commented 3 years ago

Hi! Is there any way to set default value for EnumFilter? By default, you need to define default() method inside your filter class, but I don't see any method to do it here.

Optional hack is to do something like:

(new EnumFilter('foo', BarEnum::class))->withMeta([
    'currentValue' => BarEnum::Baz
]),

I can submit PR if desired.

mdpoulter commented 3 years ago

Hi @ImJustToNy. I don't think this has been included yet, no. Feel free to submit a PR with relevant tests for it! 👍

Ideally, it should make use of the default method described in the docs.