具有角色(单选和多选)的用户管理器

1.0.12 2016-05-11 15:03 UTC

README

具有角色(单选和多选)的用户管理器

安装

composer require intothesource/users

此包还使用了 Entrance 包,有关该包的更多信息,请访问该仓库。

安装后

服务提供者

将以下行添加到 "config/app.php" 文件中的 "providers" 部分

在 "providers" 部分

IntoTheSource\Users\UsersServiceProvider::class,
Collective\Html\HtmlServiceProvider::class,

并在 "aliases" 部分

'Form'      => Collective\Html\FormFacade::class,
'Html'      => Collective\Html\HtmlFacade::class,

创建文件

运行以下命令

php artisan vendor:publish

迁移

运行命令

php artisan migrate

中间件

将以下行添加到文件 'App/Http/Kernel.php' 中的 '$routeMiddleware' 数组中

'sourceOrAdmin' => \IntoTheSource\Users\Http\Middleware\IfSourceOrAdmin::class,

如果您访问用户索引,首先需要在 配置文件 的 'Middleware' 部分中有一个角色登录

数据库种子

如果您想创建基本角色,请执行以下操作。
@note:如果您想使用此功能,请确保您还包含了 Entrance 包 的数据库种子

将以下内容添加到 'database/seeds' 文件夹中的 'DatabaseSeeder.php' 文件

$this->call(RoleTableSeeder::class);
$this->call(RoleUserTableSeeder::class);

之后,运行以下命令

php artisan db:seed

####### 或者,如果您不想这样做,请运行以下命令

first: php artisan db:seed --class=RoleTableSeeder
second: php artisan db:seed --class=RoleUserTableSeeder