brand3000/nova-roles-and-permissions 问题修复 & 功能扩展

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

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

brand3000/nova-roles-and-permissions

最新稳定版本:v1.0.9

Composer 安装命令:

composer require brand3000/nova-roles-and-permissions

包简介

This package allows separating roles for admins and other types of users while stored in the same users table. Additionally, it provides functionality for managing permissions (reader/editor) for the admins of a project powered by Laravel Nova.

README 文档

README

This package allows separating roles for admins and other types of users while stored in the same users table. Additionally, it provides functionality for managing permissions (reader/editor) for the admins of a project powered by Laravel Nova.

Screenshots

NovaRolesAndPermissions

Requirements

Laravel Nova 4

Installation

Install the package using composer

composer require brand3000/nova-roles-and-permissions

Publish the migration, models, resources, and policies

Be aware that the package will create/overwrite the next files:

  • Models:
    • app/Models/Admin.php
    • app/Models/User.php
  • Nova resources:
    • app/Nova/Admin.php
    • app/Nova/User.php
  • Policies:
    • app/Policies/AdminPolicy.php
    • app/Policies/UserPolicy.php
    • app/Policies/CorePermissions.php
php artisan vendor:publish --provider="Brand3000\NovaRolesAndPermissions\Publisher" --force

Run new migration

php artisan migrate

Set administrators

Go to your database, find the users table and choose administrators by setting the role_admin column into 1. Additionally, set the supar_admin column into 1 for those who are eligible. If you have different types of users in your project, feel free to add more role_ columns for future development.

During development

During development, you have to add all the resources you want to be managed into the array $booleanOptions of the fields() function in the app/Nova/Admin.php nova resource.

Before switching a project to the production state

Go into the NovaServiceProvider.php file and add the next logic into the gate() function

Gate::define('viewNova', function ($user) {
    return $user->role_admin;
});

If you want to seed a default super admin, run the next command

php artisan db:seed --class=SuperAdminSeeder

统计信息

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

GitHub 信息

  • Stars: 16
  • Watchers: 5
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-04-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固