owowagency / laravel-has-users-with-roles
A trait for Laravel models which have many users with roles.
Package info
github.com/owowagency/laravel-has-users-with-roles
pkg:composer/owowagency/laravel-has-users-with-roles
v2.1.0
2023-03-03 08:16 UTC
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: 2026-03-11 14:55:09 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
getUsersPivotClassmethod to return the desired pivot model class. By default it returnsPivot::class. - *Configure the
user_model_pathconfig value to tell the trait where theUsermodel 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.