But I also have a company_user pivot table, which within the above query I need to pass this in, allowing the query to show the 4 rows in the pivot table. This is then saying there are 4 users associated with this company.
This is my pivot table.
So my question is based on my code above, how can I get the pivot to work thus showing 4 users, whereas currently it shows 20 users, all the users on my test database which I don't want.
You didn't specify which users do you want. The correct way would be to set the appropriate relations, and then if you want company users, do something like this: $company->users and you'll get the users you need.
The relationship name should be companies hence your user has multiple companies, not one. So you will have o specify the id of the company you're trying to get users from.