gopex/laratrust-permission-creator 问题修复 & 功能扩展

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

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

gopex/laratrust-permission-creator

最新稳定版本:0.1.0

Composer 安装命令:

composer require gopex/laratrust-permission-creator

包简介

README 文档

README

LaratrustPermissionCreator is a Laravel package that facilitates the management of roles and permissions in your application. It provides two artisan commands, laratrust:from-config and laratrust:from-db, to read and synchronize roles and permissions either from configuration files or directly from the database.

Installation

Install the package using Composer:

composer require your-vendor/laratrust-permission-creator

Once installed, run the migrations to set up the necessary database tables:

php artisan migrate

Usage

Laratrust:from-config

The laratrust:from-config command reads roles and permissions from configuration files located in the laratrust folder at the root of your project. To create or update permissions, you can add new PHP files in the following format:

Example File: BasicRolePermissions.php

return [
    "permissions" => [
        "tour_create" => [
            "display_name" => "ساخت تور"
        ],
        "tour_edit" => [
            "display_name" => "به روز رسانی تور"
        ],
    ],
    "roles" => [
        "basic" => [
            "display_name" => "پایه",
            "description" => "این رول را همه کاربران دارند"
        ],
        "admin" => [
            "display_name" => "ادمین",
            "description" => "مخصوص ادمین کل"
        ],
        "supervisor" => [
            "display_name" => "سرپرست",
            "description" => "سرپرست اصلی تور"
        ]
    ],
    "rolesPermissions" => [
        "admin" => [
            "tour_create",
            "tour_update",
            "tour_show",
            "tour_list",
            "tour_delete",
        ],
        "supervisor" => [
            "tour_create",
            "tour_update",
            "tour_show",
            "tour_list",
            "tour_delete",
        ]
    ]
];

To execute the command:

php artisan laratrust:from-config

This will create or update the roles and permissions based on the provided configuration files.

Laratrust:from-db

The laratrust:from-db command reads roles and permissions directly from the database and updates the configuration files in the laratrust folder accordingly.

php artisan laratrust:from-db

This command ensures that your configuration files stay in sync with the current state of roles and permissions stored in the database.

License

This package is open-sourced software licensed under the MIT license. Feel free to use, modify, and distribute as needed.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL3
  • 更新时间: 2024-01-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固