Open chrillep opened 1 day ago
Thanks for pointing this out @chrillep . Can you send a PR?
Thanks for pointing this out @chrillep . Can you send a PR?
yeah, sry. I tried fixing it. But could get my head around on how to remove all the title things and use the same nameresolver as laravel pennant. :/
or reverse the nameresolver i mean. Since we need to be able to find the class from the $name variable. not sure if there is an classmap somewhere ? =). Like how enforceMorphMap works. https://laravel.com/docs/11.x/eloquent-relationships#custom-polymorphic-types
What happened?
The Filament Feature Flags package does not fully support the name property in feature classes, which leads to two related issues:
Feature Management Panel: When a feature is defined with a name property, the feature title in the management panel displays as “(Feature Deleted).” This occurs because the FeatureSegment model relies on class_exists() to resolve the feature title but does not account for aliases defined by the name property.
Blade Template Integration: Blade directives (@feature) fail to recognize aliases defined via the name property. Instead, fully qualified class names must be used, making feature references verbose and inconsistent with Laravel Pennant’s conventions.
How to reproduce the bug
Feature Management Panel:
public $name = 'enhanced-user-profiles'; }
Blade Template:
Package Version
2.1.1
PHP Version
8.3.1
Laravel Version
11.34.2
Which operating systems does with happen with?
macOS, Windows, Linux
Notes
Why is this important? Adding support for the name property improves usability by aligning Filament Feature Flags with Laravel Pennant’s conventions. It allows for cleaner, more intuitive feature references in Blade templates and ensures proper functionality in the management panel.
References: