So basically I have 4 tables

[![](https://i.stack.imgur.com/VAPiU.png)](https://i.stack.imgur.com/VAPiU.png)

The **employees**, **payrolls** and **employees\_payrolls(pivot table)** table are already connected through a many-to-many relationship and is working fine. Is it possible to fetch the **basic\_pay(from positions table)** column through **positions\_id** at **employees** table(which is already connected through the many-to-many relationship) so that I can perform calculation on **payroll** table that will base on **employees** basic pay?