laravel - Complicated Eloquent Relationships -
i have many-to-many relationship, users , roles, have worked out fine. however, have table relate well, called leads. user , user's role can assigned lead.
so example, i've created role , let's call 'manager'. now, when managing users, i'd need able assign different users different roles many-to-many relationship (a role can have many users, user can have many roles). assign role of 'manager' user a.
now, when modifying leads, i'd able assign role_user
lead (in example, i'd assign user lead), i'd first need assign role lead (manager), , able assign user of role lead.
currently, i've got many-to-many relationship setup users , roles, using pivot table name role_user
. i've got many-to-many relationship setup on pivot table, role_user
, , leads
, using pivot table named lead_role_user
.
models + controller - http://paste.laravel.com/d6h
my error: call undefined method illuminate\database\query\builder::roles()
it feels though making more difficult should be.
Comments
Post a Comment