Download the PHP package yasser/laravel-roles without Composer
On this page you can find all versions of the php package yasser/laravel-roles. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yasser/laravel-roles
More information about yasser/laravel-roles
Files in yasser/laravel-roles
Package laravel-roles
Short Description Powerful package for handling roles and permissions in Laravel 5.3
License MIT
Informations about the package laravel-roles
Roles and Permissions
- Installation
- Composer
- Service provider
- Migrations
- User trait
- Middleware
- Usage
- Create Permissions
- Create Roles
- Attach and Detach Permissions to a role
- Attach and Detach Role to a user
- Check if a user has a role
- Check if a user has a permission
- Blade directives
- Middleware functions
Installation
For you can install this package. You should to follow the next steps.
Composer
For a installation package you can use the composer command
composer require yasser/laravel-roles
or you can pull this package in through Composer file
Service Provider
Add the package to your application service providers in config/app.php
file.
Migrations
Excecute this command in your console to add migrations files to a project
php artisan vendor:publish --provider="Yasser\Roles\RolesServiceProvider" --tag=migrations
and also run the migrations
php aritsan migrate
User trait
Include HasRolesRelations
trait inside your User
model.
Middleware
Add the middleware VerifyPermission
into app/Http/kernel.php file.
Usage
Create Permissions
Create Roles
Attach and Detach Permissions to a role
You can attach one permition to a role
or you can attach many permitions to a role
Detach a one permission from a role
or you can detach many permissions from a role
Attach and Detach Role to a user
Attach a Role to a user
Attach many roles to a user
Detach a role from a user
Detach many roles from a user