定制 issafy/permissions-generator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

issafy/permissions-generator

最新稳定版本:1.0.3

Composer 安装命令:

composer require issafy/permissions-generator

包简介

:permission generation for all your declared routes with corresponding controller action

README 文档

README

Latest Version on Packagist Total Downloads Build Status StyleCI

This package add some artisan command to help generating permissions for your declared routes.

For the permissions management this package use Laravel-permission by Spatie

Usage

Each of your routes that you want to add permission should have an alias (name) seperated by dot(.) for exemple:

Route::get('/posts/special_action',[App\Http\Controllers\PostController::class, 'specialaction'])->name('posts.specialaction');
Route::get('/posts/another_action',[App\Http\Controllers\PostController::class, 'anotheraction'])->name('posts.anotheraction');

In this example permissions will be generated for the PostController linked to the specialaction and anotheraction

public function __construct()//#
{
    $this->middleware('auth');
    $this->middleware(['permission:posts.specialaction'])->only(['specialaction']);
    $this->middleware(['permission:posts.anotheraction'])->only(['anotheraction']);
        
 }//#

Take a look at contributing.md to see a to do list.

Installation

Via Composer

$ composer require mouhamedfd/permissions-generator

Publish configuration

php artisan vendor:publish --tag=permissions-generator.config

The default configuration exclude some keywords and some columns, it's also possible to add some middlewares

return [
    'excluded_keywords'=>[
        'Auth',
        'Translation',
    ],
    'have_resource_column'=>false,
    'have_description_column'=>false,
    'middlewares'=>[
        'auth',
    ],

];

Usage

Simulation mode

php artisan permission:generate

Database mode

php artisan permission:generate --action=database

Insertion to controllers

php artisan permission:generate --action=controllers

Change log

Please see the changelog for more information on what has changed recently.

Testing PHPUnit

git clone https://github.com/mouhamedfd/permissions-generator.git
composer install
cp vendor/spatie/laravel-permission/config/permission.php vendor/orchestra/testbench-core/laravel/config/permission.php
vendor/bin/testbench cache:clear
vendor/bin/testbench config:clear
composer exec phpunit [or vendor/bin/phpunit]

Contributing

Please see contributing.md for details and a todolist.

Credits

License

MIT. Please see the license file for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固