jrb-y / role-manager
A Role Manager for Laravel 5.*
Requires (Dev)
- orchestra/testbench: ^3.9@dev
- phpunit/phpunit: ^8.2@dev
This package is auto-updated.
Last update: 2025-05-29 01:24:28 UTC
README
A lightweight and simple Laravel package to manage Roles.
Feel free to make some pull requests ✌️
Contents
Installation
1 - To install the pasckage:
composer require jrb-y/role-manager
2 - If you use Laravel +5.0 no need to register the Service Provider, else you need
to register it manually.
In config/app.php
add the provider:
Jrb\RoleManager\RoleManagerServiceProvider::class,
3 - Publish the config file by running.
php artisan vendor:publish --tag=roles
Laravel will publish a config/roles.php
configuration file.
3 - Run the migrate
⚠️ if you need to customize your models, tables and foreign keys, jump to configuration
before you run the migration.
php artisan migrate
This command will create a roles
and role_user
tables.
Configuration
After you publish your configuration file, you can customize it:
- Models: You can configure your Role, User and UserRole models.
- Tables: You can configure your roles, users and user_role table.
- Foreigners: You can configure your roles and users foreign keys.
Usage
To use this package you only need to use the Jrb\RoleManager\Traits\HasRole
trait
in your User Model.
Documentation in construction.
Contribution
All contributions are welcomed.