Download the PHP package vegvisir/laratrust-cli without Composer
On this page you can find all versions of the php package vegvisir/laratrust-cli. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vegvisir/laratrust-cli
More information about vegvisir/laratrust-cli
Files in vegvisir/laratrust-cli
Package laratrust-cli
Short Description Command-line interface for Laratrust
License GPL-3.0-or-later
Homepage https://github.com/vegvisir-for-all/laratrust-cli
Informations about the package laratrust-cli
Laratrust CLI
Provides a command line interface for Laratrust (CLI). Inspired by entrust-cli.
Requirements
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.
Installation
4. Add service provider (Laravel <5.5)
If you're using Laravel up to 5.4.*, you need to add service provider in the providers
section of config/app.php
:
5. Publish config file
Usage
Laratrust CLI add the folowing artisan commands:
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 |
Team functionality
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.
User identity
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
).
User model (Eloquent/MongoDB)
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
:
Don't forget to clear your config cache after changing of the configuration:
About
Vegvisir
We're a small development team from Warsaw, Poland, looking to work remotely on your projects!
Bug reporting
Please submit all bugs and issues via GitHub. All feedback will be more than welcome!
Licence
Laratrust CLI is licensed under the GPLv3 License. See the LICENSE
file for details.