Skip to content

ampodobas/laravel-entrust-role-permission-panel

 
 

Repository files navigation

#Panel: Roles and Permissions

This repo is just a simple example to use Entrust with a custom panel to edit roles and permissions or you can simply assign permissions to a role without that panel.

#Features

  • Create/Update/Delete Roles, Permissions and Users with REST resources
  • Entrust migration contains a new column named level in roles table, it's used to display the checkboxes roles that belongsTo a user roles (see User.php, used in RolesPermissionsController.php and RoleLowerOrEqualToCurrentUser.php). It contains another column named route in permissions table, it's used if the current route equals $permission->route
  • AuthorizeMiddleware check the permissions based on route and if current user can "do something". (This is to improve to check request (POST, PATCH, DELETE) and I think it's not the better solution to do that automatically).
  • In the view I check if permission hasRole to verify if relationships exists in permission_role table

#Screenshots ###Logged as Admin Admin panel

###Logged as Editor Editor panel

#I use

#Installation

$ git clone https://github.com/Rtransat/laravel-entrust-role-permission-panel && cd laravel-entrust-role-permission-panel
$ composer install

Config your .env file in root project (laravel-entrust-role-permission-panel/.env)

DB_HOST=localhost
DB_DATABASE=database
DB_USERNAME=username
DB_PASSWORD=password
$ php artisan migrate:install
$ php artisan migrate
$ php artisan db:seed
$ php artisan serve

#Account

admin@admin.com / admin
editor@editor.com / editor
user@user.com / user

#Todo list

#You want improve this repo ?

Feel free to send your pull request

About

Simple example to assign permissions to roles with Laravel and Entrust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 99.3%
  • Other 0.7%