I have 4 tables similar to this:

**items** (id)

**subcategories** (id | category\_id)

**item\_subcategory** (item\_id | subcategory\_id) --pivot table

**categories** (id)

---

The items and subcategories are connected to the pivot table with many to many relationship. How can I get all the items under each categories? Below is an example.

* Category 1
	+ Item 1
	+ Item 2
	+ Item 3
* Category 2
	+ Item 4
	+ Item 5
* Category 3
	+ Item 2
	+ Item 3