An open API service indexing awesome lists of open source software.

https://github.com/jedymatt/laravel-roles

Demonstration of different ways to create roles
https://github.com/jedymatt/laravel-roles

laravel roles

Last synced: 4 months ago
JSON representation

Demonstration of different ways to create roles

Awesome Lists containing this project

README

        

# Laravel Role

Demonstration on how to create your own roles

## One to one

Good for single role user

## Many to Many

Good for multiple role user

### Polymorphic Many to Many

Good for multiple role user, and multiple users with different tables and guard (you can change or add middleware for different guards)

## Setup project

```sh
cp .env.example .env
```

```sh
composer install
```

```sh
php artisan migrate:fresh --seed
```

```sh
php artisan serve
```

## Files Changed

- routes/web.php
- database/migrations
- database/seeders
- database/factories
- app/Models
- app/Traits --> this is for polymorphic many to many
- app/Http/Kernel.php
- app/Http/Middleware/AuthorizeRole.php