Oct 8, 2017
0
Level 8
Build Laravel app with geographical Scoping (Multinational Segmentation)
Assuming we are building an Uber like app, and we are planning to operate in different cities and countries, business plans to have staff teams for each region, where each staff can only access data from his region and so is every other user i.e staff can see only drivers from his region, and users can only see rides in his region, in other implementation( suppliers and providers and users from his region).
what would be the best practice to implement such?
My thoughts would be (please share yours)
- Implements Global Scopes . while having region_id to each region attached model.
- Create Interface for geographical-attached models to implement (don't know what to name it).
- Would make the constructor for the Globalscope class take User Model to be able to compare against. as resolver implemented in this link https://stackoverflow.com/questions/39277768/laravel-5-global-scope-with-dynamic-parameter
Please or to participate in this conversation.