Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add enum support #33

Merged
merged 3 commits into from
May 15, 2024

Conversation

bpotmalnik
Copy link
Contributor

In this PR, I've updated trait to support BackedEnums.

Example:
I have enum with available features in the system, and middleware that is checking if given feature is enabled with some sets of rules. Different endpoint allow different features, and instead of string, I wanted to use our already existing enum.

FeatureEnabled::with([
   'feature' => Feature::Catalogue,
])

Thanks for great package!

@bpotmalnik
Copy link
Contributor Author

@timacdonald What do you think about this addition?

@binaryfire
Copy link

This would be a great addition! I'm using enums everywhere nowadays. Being able to use them as middleware params opens up a lot of possibilities.

@patrickomeara patrickomeara mentioned this pull request Mar 19, 2024
src/HasParameters.php Outdated Show resolved Hide resolved
@timacdonald timacdonald merged commit e311f34 into timacdonald:master May 15, 2024
8 of 9 checks passed
@timacdonald
Copy link
Owner

Thanks, @bpotmalnik

@bpotmalnik bpotmalnik deleted the feat/add-enum-support branch May 15, 2024 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants