vegvisir/laratrust-cli is a Laravel package for command-line interface for laratrust.
It currently has 0 GitHub stars and 12 downloads on Packagist (latest version 0.1.3).
Install it with composer require vegvisir/laratrust-cli.
Discover more Laravel packages by vegvisir
or browse all Laravel packages to compare alternatives.
Last updated
Provides a command line interface for Laratrust (CLI). Inspired by entrust-cli.
You must have Laratrust installed, configured, and working, with database migrated and whatsoever. A good documentation on how to start with Laratrust can be found at https://laratrust.readthedocs.io/en/4.0/index.html.
Good news is that Laratrust CLI is compatible also with Team functionality of the Laratrust package.
$ composer require vegvisir/laratrust-cli
If you're using Laravel up to 5.4.*, you need to add service provider in the providers section of config/app.php:
Vegvisir\LaratrustCli\LaratrustCliServiceProvider::class,
$ artisan vendor:publish
Laratrust CLI add the folowing artisan commands:
$ artisan list
...
laratrust-cli
laratrust-cli:permission:attach Attach permision to Laratrust role
laratrust-cli:permission:create Create a Laratrust permission
laratrust-cli:permission:delete Delete a Laratrust permission
laratrust-cli:permission:detach Detach permision from Laratrust role
laratrust-cli:permission:list Lists all Laratrust permissions
laratrust-cli:role:attach Add a Laratrust role to a user
laratrust-cli:role:create Create a Laratrust role
laratrust-cli:role:delete Delete a Laratrust role
laratrust-cli:role:detach Detach a Laratrust role from a user
laratrust-cli:role:list Lists all Laratrust roles
laratrust-cli:team:attach Add a Laratrust role to a user within a team
laratrust-cli:team:create Create a Laratrust team
laratrust-cli:team:delete Delete a Laratrust team
laratrust-cli:team:detach Detach a Laratrust role from a user within a team
laratrust-cli:team:list Lists all Laratrust teams
...
| Command | Action | Parameters | Example |
|:--------------------|:------------------------------------------|:----------------------------------|:---------------------------------------------------|
| *:create | Creates a role/permission/team | name [display name] [description] | laratrust-cli:role:create myrole "My Role" |
| *:delete | Deletes a role/permission/team | name | laratrust-cli:permission:delete perm1 |
| *:list | Lists all roles/permissions/teams | none | laratrust-cli:role:list |
| permission:attach | Attaches a permission to a role | permission_name role_name | laratrust-cli:permission:attach perm1 myrole |
| permission:detach | Detaches a permission from a role | permission_name role_name | laratrust-cli:permission:detach perm1 myrole |
| role:attach | Attaches a role to a user | role_name email | laratrust-cli:role:attach myrole [email protected] |
| role:detach | Detaches a role from a user | role_name email | laratrust-cli:role:detach myrole user2 |
| team:create | Creates a team | name | laratrust-cli:team:create myteam |
| team:delete | Deleted a team | name | laratrust-cli:team:delete myteam |
All laratrust-cli:team:* commands will not run unless team functionality is turned on in the Laratrust configuration. Please refer to Laratrust documentation to discover more about team functionality.
Unlike entrust-cli, Laratrust CLI looks up for users only by e-mail address. However, we intend to extend the functionality of user identification to custom attributes in the future (like in entrust-cli).
Since we develop this package within an application that utilizes Laratrust with jenssegers/laravel-mongodb, there's a possibility to use it with jenssegers/laravel-mongodb ORM.
In the config/laratrust-cli.php you need to set user_model as \Vegvisir\LaratrustCli\Models\User\UserJenssegersMongodb:
...
'user_model' => '\Vegvisir\LaratrustCli\Models\User\UserJenssegersMongodb'
...
Don't forget to clear your config cache after changing of the configuration:
$ artisan config:clear
We're a small development team from Warsaw, Poland, looking to work remotely on your projects!
Please submit all bugs and issues via GitHub. All feedback will be more than welcome!
Laratrust CLI is licensed under the GPLv3 License. See the LICENSE file for details.