owowagency / laravel-has-users-with-roles
A trait for Laravel models which have many users with roles.
Installs: 8 611
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 1
Requires
- laravel/framework: ^7.0|^8.0|^9.0|^10.0
- spatie/laravel-permission: ^5.5
Requires (Dev)
- orchestra/testbench: ^5.0|^6.0|^7.0|^8.0
- phpunit/phpunit: ^9.4
This package is auto-updated.
Last update: 2024-11-11 11:55:39 UTC
README
A trait for Laravel models which have many users with roles.
Installation
Via Composer in an already running project:
$ composer require owowagency/laravel-has-users-with-roles $ composer update
Usage
- Implement the trait in the model which will have many users with roles.
- *Override the
getUsersPivotClass
method to return the desired pivot model class. By default it returnsPivot::class
. - *Configure the
user_model_path
config value to tell the trait where theUser
model is. By default the path isApp\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.