santigarcor/laratrust
Laratrust adds role and permission management to Laravel with support for multiple user models, teams, guards, caching, events, middleware, gates/policies, and an optional admin panel for managing roles and permissions.
Five directives are available for use within your Blade templates. What you give as the directive arguments will be directly passed to the corresponding Laratrust function:
[@role](https://github.com/role)('admin')
<p>This is visible to users with the admin role. Gets translated to
\Laratrust::hasRole('admin')</p>
[@endrole](https://github.com/endrole)
[@permission](https://github.com/permission)('manage-admins')
<p>This is visible to users with the given permissions. Gets translated to
\Laratrust::isAbleTo('manage-admins'). The [@can](https://github.com/can) directive is already taken by core
laravel authorization package, hence the [@permission](https://github.com/permission) directive instead.</p>
[@endpermission](https://github.com/endpermission)
[@ability](https://github.com/ability)('admin,owner', 'create-post,edit-user')
<p>This is visible to users with the given abilities. Gets translated to
\Laratrust::ability('admin,owner', 'create-post,edit-user')</p>
[@endability](https://github.com/endability)
[@isAbleToAndOwns](https://github.com/isAbleToAndOwns)('edit-post', $post)
<p>This is visible if the user has the permission and owns the object. Gets translated to
\Laratrust::isAbleToAndOwns('edit-post', $post)</p>
[@endOwns](https://github.com/endOwns)
[@hasRoleAndOwns](https://github.com/hasRoleAndOwns)('admin', $post)
<p>This is visible if the user has the role and owns the object. Gets translated to
\Laratrust::hasRoleAndOwns('admin', $post)</p>
[@endOwns](https://github.com/endOwns)
How can I help you explore Laravel packages today?