Replies: 1 comment 1 reply
-
I think you're overcomplicating it. This package is to provide authorization responses for Users (er, models which implement Laravel's You talked about linking Models via the model_has_permissions table. I don't think that makes sense. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I currently use Laravel, Vite and Vue3.
What i'd like to do is create a navigation/module sidebar based on permissions.
What have is the following database tables.
Modules (modules)
Roles (roles)
Permissions (permissions)
Role Has Permissions (roles_has_permissions)
Now this obviously means the role
admin
has the permissionsview-products
andview-analytics
.Now what's the best way to attach a role or permissions to these modules ?
I assume I have to go to the
model_has_permissions
and add:I know I'll have to add a relationship in the
User.php
model,But I am unsure what the best relation would be between the Models for me to do something like:
is it a hasManyTrough ? Or is there a better solution and should I create something like a Service or Trait for this ?
This will be added in the
HandleInertiaRequests/ShareInertiaData
so the menu gets fetched every page change.Beta Was this translation helpful? Give feedback.
All reactions