承接 laravel/nova-pennant 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

laravel/nova-pennant

最新稳定版本:v1.1.1

Composer 安装命令:

composer require laravel/nova-pennant

包简介

A Pennant Resource Tool for Laravel Nova

README 文档

README

Nova Pennant

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'];
+   }
}

统计信息

  • 总下载量: 85.08k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 23
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 22
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 未知

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固