Cinnamon Role is a simple Role management system built for Laravel 5 with a backend Json Api for easy implementation.
- Permissions List
- Roles list
- Users list
- Add Permissions and Roles
- Connect Roles to Permissions
- Connect Users to Roles
- Create Gates for Permissions
- Add Permissions to the
Can
andAllows
methods - Easy Backend UI using ajax with Vue.js 2 components
Using Composer:
composer require mission4/cinnamon-role
Then add the service provider to your config/app.php
providers list.
Mission4\CinnamonRole\CinnamonRoleServiceProvider::class
Add the Rolable
trait to the User
model.
use \Mission4\CinnamonRole\Traits\Rolable;
And register your policies in the AuthServiceProvider boot()
method.
use \Mission4\CinnamonRole\CinnamonRole;
public function boot()
{
$this->registerPolicies();
// Register CinnamonRole Permissions Policies
CinnamonRole::registerPermissions();
}
Using Laravel Mix.
# Publish the Vue Components to the resources/assets/js/vendor/cinnamon-role directory
php artisan vendor:publish --tag=cinnamon-role
And add the Vue Components to your app.js
file and then compile your JavaScript.
Vue.component('cinnamon-role-users-table', require('./components/cinnamon-role/cinnamonRoleUsersTable.vue'));
Vue.component('cinnamon-role-permissions-table', require('./components/cinnamon-role/cinnamonRolePermissionsTable.vue'));
Vue.component('cinnamon-role-roles-table', require('./components/cinnamon-role/cinnamonRoleRolesTable.vue'));
Add these to your Blade file that you want to edit roles and permissions on.
<cinnamon-role-users-table></cinnamon-role-users-table>
<cinnamon-role-permissions-table></cinnamon-role-permissions-table>
<cinnamon-role-roles-table></cinnamon-role-roles-table>
Migrations do not rollback due to Foreign Key Constraints