Console commands | laravel-permission-rust | Spatie       

 SPATIE  

laravel-permission-rust
=======================

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Laravel-permission-rust](https://spatie.be/docs/laravel-permission-rust/v1)  Console commands

 Version   v1      

 Other versions for crawler [v1](https://spatie.be/docs/laravel-permission-rust/v1) 

  Console commands    
- [ Introduction ](https://spatie.be/docs/laravel-permission-rust/v1/introduction)
- [ Install and connect the application ](https://spatie.be/docs/laravel-permission-rust/v1/installation-laravel)
- [ Roles and permissions ](https://spatie.be/docs/laravel-permission-rust/v1/basic-usage)
- [ Authenticated routes and policies ](https://spatie.be/docs/laravel-permission-rust/v1/authorization)
- [ Querying users and bulk assignment ](https://spatie.be/docs/laravel-permission-rust/v1/querying-users)
- [ Console commands ](https://spatie.be/docs/laravel-permission-rust/v1/commands)
- [ Custom models and IDs ](https://spatie.be/docs/laravel-permission-rust/v1/models-and-ids)
- [ Cache and events ](https://spatie.be/docs/laravel-permission-rust/v1/cache-and-events)
- [ Integration tests ](https://spatie.be/docs/laravel-permission-rust/v1/testing)

 Console commands
================

Console commands
========================================================================================================

Install `service_provider::<Account, Role>()`, as shown in [installation](installation-laravel). It registers all five commands and the registrar. `Account` is your real authenticatable model. The assignment command looks it up in its native model table before writing a grant.

Run commands through your Laravel application's executable:

```
cargo run -- permission:create-permission "edit articles" web
cargo run -- permission:create-role writer web "edit articles|publish articles"
cargo run -- permission:assign-role writer 42 web
cargo run -- permission:show web
cargo run -- permission:cache-reset
```

Omit the guard argument to use `PermissionConfig::default_guard`. Create commands are idempotent. `permission:create-role` creates missing pipe-separated permissions and attaches them through the role's native relation. The role and permission writes share one database transaction. Invalid input rolls them all back.

`permission:create-role` and `permission:assign-role` accept `--team-id=17` when teams are enabled. An assignment is scoped to that team; creating a team role does not assign it globally. The account model is selected at registration, not by a caller-supplied morph name. Missing accounts fail without creating a role or assignment.

`permission:show [GUARD]` prints a native console table with guard, team, role and permission columns. It includes roles without permissions and permissions without roles. Omitting the guard lists all namespaces. `permission:cache-reset` clears the administrative permission-name catalog; authorization checks always read live grants.

All commands use Laravel's command runner, argument validation, help and exit codes. Use `permission:create-role --help`, for example, to inspect its arguments. For application-owned role models, install `service_provider::<Account, AppRole>()`. For manual registration, `register_commands::<Account, AppRole>` remains available; bind the matching `Registrar<AppRole>`.

Enable teams in configuration before migrating a new application. The package migration already includes team columns; no separate team-upgrade command is needed.

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
