Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/owowagency/laravel-has-users-with-roles
A trait for Laravel models which have many users with roles.
https://github.com/owowagency/laravel-has-users-with-roles
Last synced: 11 days ago
JSON representation
A trait for Laravel models which have many users with roles.
- Host: GitHub
- URL: https://github.com/owowagency/laravel-has-users-with-roles
- Owner: owowagency
- License: other
- Created: 2019-10-24T13:48:45.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-04-11T08:41:53.000Z (over 1 year ago)
- Last Synced: 2024-12-19T21:50:11.974Z (20 days ago)
- Language: PHP
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.md
- Contributing: contributing.md
- License: license.md
Awesome Lists containing this project
README
# Laravel: Has Users With Roles Trait
A trait for Laravel models which have many users with roles.
## Installation
Via Composer in an already running project:
``` bash
$ composer require owowagency/laravel-has-users-with-roles
$ composer update
```## Usage
1. Implement the trait in the model which will have many users with roles.
2. *Override the `getUsersPivotClass` method to return the desired pivot model class. By default it returns `Pivot::class`.
3. *Configure the `user_model_path` config value to tell the trait where the `User` model is. By default the path is `App\Models\User`.\* = Optional
## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.Please make sure to update tests as appropriate.
## License
[MIT](https://choosealicense.com/licenses/mit/)