承接 jameron/regulator 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

jameron/regulator

Composer 安装命令:

composer create-project jameron/regulator

包简介

Auth and role/permissions manager

README 文档

README

This package has been built to work with Laravel 5.4.33 and later. (Some older versions of Laravel may not be compatible.)

This package contains methods and traits that can be used with your project, and optionally you can use the views for your UX. If you are using the admin views, make sure you also require the admin package found here: Admin package

Your composer file would look like so:

        "jameron/admin": "*",
        "jameron/regulator": "*",

Let's see if we can't get you up and running in 10 steps. If you are starting fresh, create your laravel application first thing:

composer create-project --prefer-dist laravel/laravel blog
  1. Add the package to your compose.json file:
    "jameron/regulator": "*",
composer update

**NOTE Laravel 5.5+ users there is auto-discovery so you can ignore steps 2 and 3

  1. Update your providers:
        Jameron\Regulator\RegulatorServiceProvider::class,
  1. Update your Facades:
        'Regulator' => Jameron\Regulator\Facades\RegulatorFacade::class,
  1. Publish the sass, js, and config:
php artisan vendor:publish

**NOTE: Select the number that coorelates to the jameron/regulator package

  1. Run your migrations:

**NOTE: the Regulator package depends on Laravel Auth so if you haven't set it up yet run:

php artisan make:auth

**NOTE: DELETE the Auth::routes() from routes/web.php, the Regulator package includes these routes for you.

Alright now go ahead and migrate:

php artisan migrate

If you get this error

[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table `users` add unique `users_email_unique`(`email`))``` 

You need to add this to your AppServiceProvider

use Illuminate\Support\Facades\Schema;

function boot()
{
    Schema::defaultStringLength(191);
}
  1. Seed up the database with two roles and a few permissions

You can call it directly via command line or add it to your applications seeder file:

Added to application seeder

database/seeds/DatabaseSeeder.php

$this->call(\Jameron\Regulator\database\seeds\RegulatorSeeder::class);

Called via command line:

php artisan db:seed --class=\\Jameron\\Regulator\\database\\seeds\\RegulatorSeeder

  1. Update your App\User.php
use Jameron\Regulator\Models\Traits\HasRoles;
class User extends Authenticatable
{
	use HasRoles;

You will also want these methods on your User model

    public function getRoleAttribute()
    {
        $roles = [];
        foreach($this->roles()->get() as $role) {
            $roles[] = $role->slug;
        }
        return implode(',', $roles);
    } 

    public function getEnabledAttribute()
    {
        return ($this->disabled) ? 'no' : 'yes';
    }
  1. If you setup you project to use the database driver for sessions you can see when users are logged in or not. To set up the database session driver:
php artisan session:table

php artisan migrate
  1. Subscribe to the login and logout events to update the users last_login and last_logout timestamp on the user model. Add this to app/Providers/EventServiceProvider.
protected $subscribe = [
\Jameron\Regulator\Listeners\UserEventSubscriber::class,
];
  1. Update your webpack.mix.js file
   .js('resources/assets/regulator/js/RegulatorDependencies.js', 'public/js/Regulator.js')
   .sass('resources/assets/regulator/sass/regulator.scss', 'public/css')
  1. Make sure you have vuex installed, it is used with the role permissions component.
npm install vuex --save
  1. Compile it up:
npm run dev

jameron/regulator 适用场景与选型建议

jameron/regulator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 102 次下载、GitHub Stars 达 0, 最近一次更新时间为 2017 年 11 月 07 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「roles」 「permissions」 「lms」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 jameron/regulator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 jameron/regulator 我们能提供哪些服务?
定制开发 / 二次开发

基于 jameron/regulator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-11-07