creode/laravel-nova-account-approval 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

creode/laravel-nova-account-approval

最新稳定版本:1.3.1

Composer 安装命令:

composer require creode/laravel-nova-account-approval

包简介

A simple package which integrates with the laravel-account-approval package to grant additional actions within Nova.

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A simple package which integrates with the laravel-account-approval package to grant additional actions within Nova.

Installation

You can install the package via composer:

composer require creode/laravel-nova-account-approval

Usage

This package currently just exposes some actions that can be used in Nova resources to activate and deactivate users.

This functionality is tied directly to the laravel-account-approval package, using it as a dependency of this one.

Setting up the actions

To use the actions, you need to add them to your Nova resource. For example, if you have a User resource, you can add the actions like so:

/**
 * Get the actions available for the resource.
 *
 * @param  \Laravel\Nova\Http\Requests\NovaRequest  $request
 * @return array
 */
public function actions(NovaRequest $request)
{
    return [
        (new \Creode\LaravelNovaAccountApproval\Actions\ApproveAccount)
            ->confirmText('Are you sure you want to approve this account?')
            ->confirmButtonText('Approve')
        ->cancelButtonText("Don't Approve"),
        (new \Creode\LaravelNovaAccountApproval\Actions\DeactivateAccount)
            ->confirmText('Are you sure you want to deactivate this account?')
            ->confirmButtonText('Deactivate')
            ->cancelButtonText("Don't Deactivate"),
    ];
}

Actions are configured to be both inline and in bulk so they can be used to easily approve/deactivate multiple users at once from the main screen.

It may also be useful to display the status of the user in the resource index. This can be done by adding the following to the fields method of the resource:

/**
 * Get the fields displayed by the resource.
 *
 * @param  \Laravel\Nova\Http\Requests\NovaRequest  $request
 * @return array
 */
public function fields(NovaRequest $request)
{
    return [
        // Other fields...

        Boolean::make('Activated')
            ->sortable()
            ->rules('required', 'boolean'),

        // More other fields...
    ];
}

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-01-17