Code Monkey home page Code Monkey logo

laravel-permission's Introduction

laravel-permission

A laravel package about permission management

演示地址

项目概述

  • 前后端分离后端权限管理的最佳实现方式(提供 API 配合前端使用)

安装

  • composer require zmecust/laravel-permission

配置

  • 添加 service provider: \Zmecust\LaravelPermission\ZmecustServiceProvider::class

  • 添加 UserTrait: 在用户表模型中添加 use Zmecust\LaravelPermission\Traits\ZmecustUserTrait

  • 添加 Middleware: 在 Http kernel.php 添加 'check.login' => \Zmecust\LaravelPermission\Middleware\CheckLogin::class'check.permission' => \Zmecust\LaravelPermission\Middleware\CheckPermissions::class, 并在 zmecust.php 文件中配置 middleware

  • 配置文件: php artisan vendor:publish --provider="Zmecust\\LaravelPermission\\ZmecustServiceProvider"

配置说明

return [
    'user_table' => [
        'name'  => 'users',
        'model' => \App\User::class, //用户模型
    ],

    'router' => [
        'prefix' => 'admin', //路由前缀
    ],

    'middleware' => ['auth'], //中间件

    'service_name' => '' //项目名,非必须
];

laravel-permission's People

Contributors

zmecust avatar

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.