The best approach would be a polymorphic relation
Documentation: https://laravel.com/docs/5.5/eloquent-relationships#polymorphic-relations
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Fees can be charged in one out of eight ways in my case as in below relationships
1. group->location->service->provider->fee
2. group->service->provider->fee
3. group->location->provider->fee
4. group->location->service->fee
5. group->provider->fee
6. group->service->fee
7. group->location->fee
8. group->fee
Example - A group has 3 Locations, 5 Services, 10 Providers
Case 1: 150 Records (1 * 3 * 5 * 10) group->location->service->provider->fee
Case 2: 50 Records (1 * 5 * 10) group->service->provider->fee
Case 3: 30 Records (1 * 3 * 10) group->location->provider->fee
Case 4: 15 Records (1 * 3 * 5) group->location->service->fee
Case 5: 10 Records (1 * 10) group->provider->fee
Case 6: 5 Records (1 * 5) group->service->fee
Case 7: 3 Records (1 * 3) group->location->fee
Case 8: 1 Record (1) group->fee
Please suggest right approach, tables, eloquent relationship to handle this.
The best approach would be a polymorphic relation
Documentation: https://laravel.com/docs/5.5/eloquent-relationships#polymorphic-relations
Please or to participate in this conversation.