This question extends the example Eloquent : Working With Pivot Tables provided in the Laravel Documentation.
The relationship here is that a User has many Role objects that it can relate to. In this extension, each Role will relate to a number of Task objects, giving us a second level many-to-many relationship.
Using Eloquent ORM, what would be the neatest way of accessing the Tasks that a user relates to?
Specifically, the following method should return an array of task_ids
User::get_tasks($user_id)
idsonly use joins, in order to easy access theTaskmodels, use this stackoverflow.com/a/26187648/784588 - Jarek Tkaczyk