binssoft/permissionmanager 问题修复 & 功能扩展

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

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

binssoft/permissionmanager

Composer 安装命令:

composer require binssoft/permissionmanager

包简介

It is a permission manager library for laravel

README 文档

README

A permission management system to handel the user role in a Laravel 5 project.

Installation

This package is only installed via composer by requiring the

composer require binssoft/permissionmanager

package in your project's composer.json. (The installation may take a while.)

{
  "require": {
     "binssoft/permissionmanager": "<version-name>"
  }
}

Next, add the service provider to config/app.php.

'providers' => [
 ...
    Binssoft\Permissionmanager\PermissionManagerServiceProvider::class
]
'aliases' => [
...
 'Permission'=> Binssoft\Permissionmanager\PermissionManager::class
 ]

Configuration

php artisan vendor:publish
php artisan migrate

After proper vendor publish few files are created and 4 tables will be created in the configured database after migration.

  1. in app/ folder 4 models will generated Roles.php, Navigations.php, UserRoles.php, RolePermissions.php

  2. in database\seeds folder RoleSeeder.php will be created

php artisan db:seed --class=RoleSeeder

Few demo role records will be inserted in the roles Table

Now your permission library is configured perfectly.

How to Uses

use Permission;

Assign user Role

Permission::assignUserRole(<user_id>,<role_id>);

Get user Role

Permission::getUserRole(<user_id>);

Get all navigations

Permission::navigations(['namespace'=>["admin"]]); 

namespace will be a array with value of your different namespaces like admin,site etc.

Set role Permission

  • 1st parameter : role id
  • 2nd parameter : route name
  • 3rd parameter : want to save or delete (true/false)
Permission::setRolePermission(1, 'admin_user_list', true); 

Check current route access permission

$permission = Permission::access(<role_id>);

$permission will return true or flase

That's it! You're good to go.

Please click on "Star" in github if it is usefull for you.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-09-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固