Giter VIP home page Giter VIP logo

laravel5-rbac's Introduction

Larval 5.2 Rbac 示例

说明

  • 这只是一个基于Laravel5.2 和 zizaco/entrust实现的RBAC的简单示例应用,可以扩展一下应用到实际项目中。

  • 参考了yuansir/laravel5-rbac-example 的一些实现。

  • 超级管理员默认ID为1。

  • permissions表中有一个group字段标识后台菜单分组,数值对应<project>/config/menu.php文件的配置。

安装步骤

  • clone代码到本地, git clone [email protected]:curder/laravel5_rbac.git

  • 项目目录下执行 composer install

  • 配置 .env 中数据库连接信息

  • 执行 php artisan key

  • 项目目录下执行 php artisan migratephp artisan db:seed,填充默认的数据库表结构和RBAC相关数据

    • 如果使用mac系统使用mamp环境,执行 php artisan migrate的时候可能出现错误,如下:
     	[PDOException]                                    
     	SQLSTATE[HY000] [2002] No such file or directory
    

    解决方案,参考这里: Getting this error? [PDOException] SQLSTATE[HY000] [2002] No such file or directory

    • 如果在安装过程中报如下错误

    FatalErrorException in Container.php line 698: Maximum function nesting level of '100' reached, aborting! ```

    修改php.ini文件xdebug.max_nesting_level=500,参考这里:fatal-error-maximum-function-nesting-level-of-100

  • 项目目录下执行 php artisan serve 使用默认的 http://localhost:8000访问首页

  • 默认后台账号: [email protected] 密码 : aaaaaa

以下是截图

普通测试用户权限

管理员授权

感谢开源

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.