I've exhausted searching and reading through potential solutions, but I can't wrap my head around how to do it, so i'm hoping someone here might help me!

I have three models: Clients, Services and Users.

* A Client has many Services
* and Services belong to many Clients.
* Users can have many Services through a Client.

Real world example:

* Client (Company XYZ) has these available Services (payments, invoicing, time tracking).
* User (Bob) is assigned to the Client (Company XYZ)
* and for this specific Client, he has access to the payments and invoicing Services.

Pictured below is the DB design (it doesn't have to be implemented exactly as this).

What would be the best approach to implement this? A custom pivot table?

[![enter image description here](https://i.stack.imgur.com/0yCPr.jpg)](https://i.stack.imgur.com/0yCPr.jpg)