https://github.com/akunbeben/fortify-role
Multi Roles authentication package for Fortify.
https://github.com/akunbeben/fortify-role
auth authentication fortify hacktoberfest laravel laravel-package laravel-ui multi-authentication roles
Last synced: 23 days ago
JSON representation
Multi Roles authentication package for Fortify.
- Host: GitHub
- URL: https://github.com/akunbeben/fortify-role
- Owner: akunbeben
- License: mit
- Archived: true
- Created: 2021-05-02T11:59:53.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-05-17T20:59:47.000Z (over 4 years ago)
- Last Synced: 2025-11-09T00:17:47.957Z (3 months ago)
- Topics: auth, authentication, fortify, hacktoberfest, laravel, laravel-package, laravel-ui, multi-authentication, roles
- Language: PHP
- Homepage: https://packagist.org/packages/akunbeben/fortify-role
- Size: 50.8 KB
- Stars: 5
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fortify Role
Basic Multi Roles authentication package for Fortify.
[](https://github.com/akunbeben/fortify-role/blob/master/LICENSE)
[](https://github.com/akunbeben/fortify-role)
[](https://github.com/akunbeben/fortify-role)
## Requirement
- Laravel ^8.x
- Laravel/Fortify ^1.x
## Installation
I recommended you to install this package only on a fresh project.
Install the package using composer
```
composer require akunbeben/fortify-role
```
## Usage
Before continuing the process, please make sure the `FortifyServiceProvider.php` is registered in `config/app.php`. If it's already registered, you can skip this.
```php
'providers' => [
...
App\Providers\FortifyServiceProvider::class,
],
```
Then publish the package's vendor files. It's need `--force` because it will replace the `RedirectIfAuthenticated` middleware.
```
php artisan vendor:publish --provider="Akunbeben\FortifyRole\FortifyRoleServiceProvider" --force
```
And then, add `HasRole` traits to your `User` model.
```php
['auth', 'role:admin']], function () {
});
Route::group(['middleware' => ['auth', 'role:user']], function () {
});
```
### Notes
- On the roles table migration file, there is a default value to assign the role to registered user. You can adjust it to your need.