linearsoft/entrust-cli

为 Laravel 的 Entrust 提供控制台界面

v0.5.2 2016-06-03 16:04 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:58:29 UTC


README

为 Laravel 的 Entrust 提供控制台界面

目前此包只支持 Laravel 5 的 Entrust。

要求

在尝试使用 Entrust-Cli 之前,您必须已安装并配置好 Entrust。

在使用 Entrust-Cli 之前,您必须已配置好 Entrust 服务提供者和别名。

'providers' => [
    ...
    Zizaco\Entrust\EntrustServiceProvider::class,
    ...
],
'aliases' => [
    ...
     'Entrust'   => Zizaco\Entrust\EntrustFacade::class,
    ...
],

您还必须创建好 Entrust 数据库表。

php artisan entrust:migration
php artisan migrate

有关安装和配置 Entrust 的更多信息,请访问 Entrust GitHub

安装

使用以下命令安装最新版本

$ composer require linearsoft/entrust-cli

然后,在您的 config/app.php 中,您必须在 providers 数组中添加

    LinearSoft\EntrustCli\EntrustCliServiceProvider::class,

使用方法

Entrust-Cli 添加了以下 artisan 命令

php artisan list
 ...
 entrust-cli
  entrust-cli:permission:attach  Add a permission to an Entrust role
  entrust-cli:permission:create  Create an Entrust permission
  entrust-cli:permission:delete  Delete an Entrust permission
  entrust-cli:permission:detach  Remove a permission from an Entrust role
  entrust-cli:permission:list    List all Entrust permissions
  entrust-cli:role:attach        Add an Entrust role to a user
  entrust-cli:role:create        Create an Entrust role
  entrust-cli:role:delete        Delete an Entrust role
  entrust-cli:role:detach        Remove an Entrust role from a user
  entrust-cli:role:info          Show details for an Entrust role
  entrust-cli:role:list          List all Entrust role
  
 ...

用户身份

Entrust-Cli 无法确定您的应用程序使用什么属性来查找用户记录。默认情况下,它将检查 email 属性,然后回退到 username。如果您的用户模型不使用这些属性之一,您必须手动指定要搜索的属性

entrust-cli:role:attach myrole "John Doe" --attr=name
entrust-cli:role:attach myrole 8846811346 --attr=barcode

关于

错误或功能请求

发现问题或想要一个功能,请通过 GitHub 提交

许可

Entrust-Cli 根据 GPLv3 许可证授权 - 有关详细信息,请参阅 LICENSE 文件