laravel/nova-pennant
A Pennant Resource Tool for Laravel Nova
Maintainers
Requires
- php: ^8.1
- illuminate/support: ^10.48.29|^11.44.1|^12.1.1|^13.0.0
- laravel/nova: ^5.8
- laravel/pennant: ^1.22.0
- symfony/polyfill-php83: ^1.33
Requires (Dev)
- laravel/nova-devtool: ^1.9.0
- laravel/pint: ^1.20
- orchestra/pest-plugin-testbench: ^2.0|^3.0|^4.0
- orchestra/testbench: ^8.24|^9.2|^10.0|^11.0
- phpstan/phpstan: ^2.1.15
- spatie/laravel-ray: ^1.40.2
Suggests
None
Provides
None
Conflicts
None
Replaces
None
MIT 809eee1daee8e9ab66e93adfde84ff56015f5401
- Taylor Otwell <taylor.woop@laravel.com>
- Mior Muhammad Zaki <mior.woop@laravel.com>
This package is auto-updated.
Last update: 2026-06-23 11:40:27 UTC
README
This package makes it easy to view and manage Laravel Pennant features for your Laravel application inside of Nova.
Installation
You can install the Nova tool via Composer:
composer require laravel/nova-pennant
Next, you must register the tool within the User Resource.
use Laravel\Nova\PennantTool\PennantTool; /** * Get the fields displayed by the resource. * * @return array */ public function fields(NovaRequest $request) { return [ ID::make()->sortable(), Text::make('Name') ->sortable() ->rules('required', 'max:255'), Text::make('Email') ->sortable() ->rules('required', 'email', 'max:254') ->creationRules('unique:users,email') ->updateRules('unique:users,email,{{resourceId}}'), Password::make('Password') ->onlyOnForms() ->creationRules('required', Rules\Password::defaults()) ->updateRules('nullable', Rules\Password::defaults()), PennantTool::make(), ]; }
Usage
Authorization to Modify Feature Values
By default, Nova users will not have access to activate or deactivate features when they are authorized to see the resource. You need to use the canRun() method to authorize all or specific users.
use Laravel\Nova\Http\Requests\NovaRequest; use Laravel\Nova\Nova; use Laravel\Nova\PennantTool\PennantTool; // ... PennantTool::make() ->canRun(fn (NovaRequest $request) => Nova::user($request)->admin),
Password Confirmation
You can also require the user to confirm their password before activating or deactivating a feature by using requiresConfirmPassword() method:
use Laravel\Nova\PennantTool\PennantTool; // ... PennantTool::make() ->requiresConfirmPassword(),
Rich Feature Values
In order to configure rich values Nova would need to depend on a class-based feature and utilize options(mixed $scope) method:
namespace App\Features;
class UserTier
{
public $name = 'user-tier';
+ public function options(mixed $scope): array
+ {
+ return ['solo', 'pro'];
+ }
}
