acr/roles

该包的最新版本(dev-master)没有可用的许可信息。

:描述

安装: 10

依赖: 0

建议者: 0

安全: 0

星星: 0

关注者: 1

分支: 0

开放问题: 22

语言:CSS

dev-master 2019-05-30 09:01 UTC

README

Latest Version on Packagist Total Downloads Build Status

安装

通过 Composer

$ composer require acr/roles
Php Artisan
$ php artisan vendor:publish --provider="acr\roles\rolesServiceProvider"
$ php artisan make:auth
$ php artisan migrate
$ php artisan make:model Role
添加 config/app.php 配置文件
acr\roles\rolesServiceProvider::class,
插入 Models User.php 模型
function roles() {
   return $this->belongsToMany('App\Role');
}
controller.php 控制器
$acrRolesFilesPathJs = "/vendor/acr/roles/static/js";
$acrRolesFilesPathCss = "/vendor/acr/roles/static/css";
$scannedDirectoryJs = array_diff(scandir($acrRolesFilesPathJs), array('..', '.'));
$scannedDirectoryCss = array_diff(scandir($acrRolesFilesPathCss), array('..', '.'));
layout.blade.php 布局
<html>
    <head>
        <!-- push target to head -->
        @stack('styles')
        @stack('scripts')
    </head>
    <body>
        <!-- or push target to footer -->
        @stack('scripts')
    </body>
</html>
view.blade.php 视图
@push('styles')
   @foreach($scannedDirectoryCss as $file) 
      <link href="{{"/$file"}}" rel="stylesheet">
   @endforeach
@endpush
@push('scripts')
    @foreach($scannedDirectoryJs as $file) 
      <script type="text/javascript" src="{{ "/$file" }}"></script>
    @endforeach
@endpush

用法

您的用户页面链接并添加角色

 #/acr/roles/user/{{$user_id}}
 #/acr/roles/new

测试

$ composer test

安全

如果您发现任何安全相关的问题,请通过作者邮箱而不是使用问题跟踪器。

致谢

许可

许可。请参阅许可文件以获取更多信息。