simplesquid / nova-enum-field

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

EnumBooleanFilter and EnumFilter not working properly #36

Closed nathan-io closed 3 years ago

nathan-io commented 3 years ago

For me, both EnumBooleanFilter and EnumFilter are buggy.

Example from one of my resources:

namespace App\Nova;

// ...
use SimpleSquid\Nova\Fields\Enum\Enum;
use SimpleSquid\Nova\Fields\Enum\EnumFilter;
use App\Enums\PassStatus\StatusType;
use App\Enums\PassStatus\ReasonType;

// ...

    public function filters(Request $request)
    {
        return [
            new EnumFilter('status', StatusType::class),
            new EnumFilter('reason', ReasonType::class),
        ];
    }

The output is this. Both dropdowns contain the enum values for StatusType.

If I switch the order, so ReasonType comes first, then both of the dropdowns are "Reason".

And even though the filters are identical, filtering doesn't really work properly for either of them.

I haven't seen any closed issues for this, and people seem to be using the feature. Maybe this is a new behavior in recent Nova versions?

mdpoulter commented 3 years ago

This definitely looks like a bug. I will try and look into it in the next few days.

nathan-io commented 3 years ago

Thank you!

nathan-io commented 3 years ago

Hi @mdpoulter was curious if you got a chance to look at this. Thank you!

aneip commented 3 years ago

Need to add the follow code to differentiate between same class in EnumFilter.php

`
/**

mdpoulter commented 3 years ago

Thanks so much @aneip for the fix 👍

Sorry for the delay @nathan-io - it's been a busy few weeks 😅

nathan-io commented 2 years ago

Thank you!