thedevdojo / voyager

Voyager - The Missing Laravel Admin
https://voyager.devdojo.com
MIT License
11.72k stars 2.67k forks source link

How Authorize Works in Voyager and add Custom Roles? #5838

Open blpraveen opened 4 months ago

blpraveen commented 4 months ago

Laravel version

Laravel 9

PHP version

Php version 8

Voyager version

1.4.3

Description of problem

I have customer roles and permission like admin, organizer and customer.

How can add own menu items and data types to organizer and customer?

Proposed solution

Show be able add new roles and own menu and data types . Restrict data by logged in user.

Alternatives considered

No response

Additional context

No response

Emerica commented 4 months ago

If I understand right, you might be confused about permissions/roles.
Maybe you meant to say you have roles, "admin, organizer and customer"

Each of those roles can have different permissions for each model. (browse, read, edit, add, delete) You can set these permissions in each role.

The side menu and associated views/actions will only show/work when the authenticated user has a role with browse permissions for the associated model.

See: https://github.com/thedevdojo/voyager/blob/1.6/docs/core-concepts/roles-and-permissions.md