Laravel 5 Entrust - Users belong to many apps

andcl

I am using Entrust package in Laravel 5.3 for managing user roles and permissions, and it works perfectly.

The problem is that my users belong to many apps, so I need to check roles and permissions having into account in which app are they trying to perform the actions in each case.

As Entrust does not provide that feature out of the box... Should I add an app_id field to the pivot Entrust role_user table? Then, how would I check the roles in each case? By overriding Entrust methods?

Thanks in advance.

andcl

Just for the record, I have found a Laravel 5 Package called Laratrust (https://github.com/santigarcor/laratrust/tree/master) which in its master branch now supports "groups implementation", where roles can be attached to users within a group. And that is exactly what I needed, considering my apps as groups, so I am going to give it a try :)

Digging a little into the code and its database design, I have to say that I was right when I thought of adding an app_id field to the pivot role_user table... That is exactly as this package implements that relation.

Thanks ;)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Laravel 5 entrust attachRolle

Laravel 5 with entrust - hasRole not working

Laravel 5 Entrust update user roles

Laravel 5 Entrust one route - load different controller based on Role

How to filter Laravel 5 eloquent query using entrust

How to display all permissions a role has in laravel 5 entrust?

Laravel Showing all users and check if belong to Bans table

Rails 5: find all Users who belong to Companies, which belong to current_user

Laravel routes with entrust

Laravel 5.5 and Entrust

How can I make a user has_many objects but each object can belong_to MANY users?

Laravel relationships many to many with recursive users table

Add multiple permissions to one role entrust Role-based Permissions for Laravel 5

Need suggestions on using Entrust roles in a single resource controller - Laravel5

Laravel authentication with Ardent, Entrust & Confide

Entrust laravel hasRole function was not working

Working with routes and Entrust in Laravel 5.2

Entrust - Get all users where role is

Laravel 5 - Many to Many - Attach versus Save

save many to many relation in Laravel elequent 5?

Laravel 5 | Many to Many Relationship not working

Laravel 5 Validate many to many data

Make models belong to users in django

Entrust Facade @role not working on Laravel 5.1

Exception when using Entrust middleware in Laravel 5.1

Entrust with Laravel - Eloquent queries with conditional roles

Laravel - How to get Entrust Roles of a specific user

Laravel - Get last 5 registered users attributes

Changing the name of the "users" table to account Laravel 5