Download the PHP package joshbrw/laravel-permission-manager without Composer
On this page you can find all versions of the php package joshbrw/laravel-permission-manager. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download joshbrw/laravel-permission-manager
More information about joshbrw/laravel-permission-manager
Files in joshbrw/laravel-permission-manager
Package laravel-permission-manager
Short Description Laravel Permission Manager
License MIT
Informations about the package laravel-permission-manager
Laravel Permission Manager
This package provides a simple way of registering permissions, organising them by group and then retrieving all permissions. These permissions can then be assigned to User/Role entities and used for Access Control logic.
Installation
- Install the package using
composer require joshbrw/laravel-permission-manager
- If you're using Laravel 5.5 this is all that is required, the package will automatically load its' own Providers and Facades. If you're using Laravel 5.4, read on.
-
Then register the Service Provider in
config/app.php
to ensure that the container bindings etc are loaded: -
You can then optionally register the
Permissions
facade if you'd rather usePermission::registerPermissions()
rather than using thePermissionManager
directly: - You are now installed!
Registering Permissions
Permissions should usually be registered in the boot()
method ophpuf a Service Provider - this ensures that this package has been able to register itself using it's own register()
method first.
Using the Facade
The simplest way of registering permissions is using the Permissions
facade. The following example registers the user.list
and user.create
permissions within the User
group:
Using the Trait
You can also use the RegistersPermissions
trait if you're not a fan of Facades, for example: