laravel / pennant

A simple, lightweight library for managing feature flags.
https://laravel.com/docs/pennant
MIT License
474 stars 48 forks source link

Retrieve all defined flags #99

Closed flexchar closed 5 months ago

flexchar commented 5 months ago

Hey! We currently can retrieve all flags for a scope (user) using Feature::all() or $user->features()->all. How about retrieving a list of flags that can be used without their status/value?

I am writing an action for Laravel Nova so that staff could toggle the flags, or provide a rich value, if applicable. Of course I can take the keys from the previous method since they all will be same for all the application but perhaps we could introduce a method to retrieve all registered features.

What do you think?

I am open to contributing as well.

driesvints commented 5 months ago

Hi @flexchar. In this case, it's best that you send in a PR so we can look at the code involved. Thanks

flexchar commented 5 months ago

I understand. Time is precious. What are your thoughts before code is written? @driesvints

driesvints commented 5 months ago

I don't maintain the codebase of Pennant directly. It's best that you just send in a PR with your idea. If it doesn't work out you can always adopt the code directly or fork the package.

timacdonald commented 5 months ago

@flexchar, you should be able to use Feature::defined() to retrieve all defined features for a the driver.

flexchar commented 5 months ago

Thank you Tim! It actually was it. I put a todo to make a PR for laravel docs to mention it. :)

PS. Thank you for this great package!