jrb-y/role-manager

There is no license information available for the latest version (dev-master) of this package.

A Role Manager for Laravel 5.*

dev-master 2021-04-29 13:17 UTC

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:

  1. Models: You can configure your Role, User and UserRole models.
  2. Tables: You can configure your roles, users and user_role table.
  3. 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.