This packages provide a graphical wrapper around ryangjchandler/laravel-feature-flags.
You can install the package via Composer:
composer require ryangjchandler/filament-feature-flags
You should also follow the installation instructions for underlying package;
Once installed, this package will register a new "Features" resource.
To add a new flag, click the "Add Feature" button and you'll be presented with a form.
The only required field in the form is the "Name" field. The "Description" field is optional and only serves as metadata for users.
You can toggle the value of flag by switching the toggle input labelled "Enabled".
You should follow the documentation on setting up models for feature flags before continuing.
Being by implementing the RyanChandler\FilamentFeatureFlags\Contracts\FlaggableResource
interface on your chosen Resource
class.
use RyanChandler\FilamentFeatureFlags\Contracts\FlaggableResource;
class CustomerResource extends Resource implements FlaggableResource
{
public static function getFlaggableRecordDisplayColumn(): string
{
return 'name';
}
}
The getFlaggableRecordDisplayColumn()
method should return the name of the column you'd like to display when searching for your flaggable records.
Now that you've implemented the FlaggableResource
interface, you should be able to see your resource show up as an option in the "Resource Type" field.
If you select the resource, you'll see a new "Resource" field appear underneath. This field is a searchable Select
field and can be used to search for and choose the record this flag is associated with.
Once you've selected a record, save the feature flag and it will be associated with it.
The table will show all flags, including flags associated with models / resources.
The "Name" field is searchable and the "Enabled" column can be clicked to toggle the flag.
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.