1

I'm using Laravel and Zizaco Entrust package. I have the table role_user with two columns, role_id and user_id. Now I would add a third column, like company_id so the same user can had different role in different company.

In RoleUser model, i have added an accessor like:

    public function getRoleIdAttribute($value) {
return... 
   } 

So, In the accessor I can retrive the correct role_id, without modify the source of the package. Is this the right way? The accessor like this doesn't works, I get always the db value even if I return a random number.

Can you help me? Thanks!

cent89
  • 113
  • 1
  • 9

0 Answers0