Download the PHP package rs/laravel-doorman without Composer
On this page you can find all versions of the php package rs/laravel-doorman. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rs/laravel-doorman
More information about rs/laravel-doorman
Files in rs/laravel-doorman
Package laravel-doorman
Short Description Will the doorman let you in? Only if you've got the right set of permissions.
License mit
Informations about the package laravel-doorman
Laravel Version Control
This package provides traits to use to quickly scaffold role based permissions to your laravel project.
Once installed we can do the following:
``
Permissions are registered with Laravel's gate and so it is possible to check using any laravel gate methods.
Installation
`
The service provider will be automatically registered.
Configuration file can be published using the artisan command.
`
Configuration
Configuration allows you to specify which models you would like to use for the Role and Permission. By default they use models defined by the package. If extra functionality is required or you would like to use your own models then they can be updated here.
Migrations
`
This will run the default migrations needed. If you like to change the default migrations you can publish the migration files.
`
If you dont want any migrations to run then you can disable the migrations in the config file.
Basic usage
User
Add the HasPermissionsViaRoles
trait to your User
model.
A role can be assigned to any user:
A role can be removed from a user:
Roles can also be synced:
You can determine if a user has a certain role:
Permissions and roles can be accessed from the user using the HasPermissionsViaRoles
trait.
You can check if a user has a permission:
Permissions and roles
A permission can be assigned to a role using 1 of these methods:
Multiple permissions can be synced to a role using 1 of these methods:
A permission can be removed from a role using 1 of these methods:
Permission and role customization
If you would like to setup your own permission and role models then you can update the configuration to use your own models.
The existing doorman models can be extended or the models can use the existing traits.
When implementing your own models the models must fulfil the Role
and Permission
Contracts.
An example of a role model.
An example of the permission model.