How I implement "Spatie/laravel-permission" in a completed project #1805
-
How would I implement the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Take a look at |
Beta Was this translation helpful? Give feedback.
-
On the config file you only can change the table names and user foreign key for custom ones, fields like laravel-permission/src/Models/Role.php Lines 48 to 70 in a6e4122 laravel-permission/src/Models/Permission.php Lines 51 to 73 in a6e4122 Also, you have to override the traits, (On User model) laravel-permission/src/Traits/HasRoles.php Lines 40 to 49 in a6e4122 laravel-permission/src/Traits/HasPermissions.php Lines 43 to 52 in a6e4122 And now must be working, a lot overrides, maybe can be a new feature, you have to ask to @freekmurze @drbyte, looks easy to set a config for this , i have time for make a PR |
Beta Was this translation helpful? Give feedback.
On the config file you only can change the table names and user foreign key for custom ones, fields like
name
andguard_name
can't change,If you want to change
role_id
andpermission_id
pivots you have to create modelsRole
andPermission
extends from spatie models, and override relations and replace default foreign keyslaravel-permission/src/Models/Role.php
Lines 48 to 70 in a6e4122