api-platform / api-platform/core
[Laravel] Multi-tenancy support
- 主要語言
- PHP
- 星號
- 2.6k
- 分支
- 980
- 平均合併
- 2 天 5 小時
- 30 天內合併 PR
- 48
描述
**Description**
I would like to use API Platform alongside the [Tenancy](https://tenancyforlaravel.com/) package. The [concept](https://tenancyforlaravel.com/docs/v3/the-two-applications) behind Tenancy is simple. There are two types of databases (applications):
- A central database, which stores the list of all tenants (along with other non-tenant-dependent data).
- Multiple tenant databases, where tenant-specific data is stored.
Based on the request, we determine which database should be used for tenant-specific models. And here lies the problem: API Platform only recognizes the structure of the central database at startup and caches the model attributes. As a result, it cannot find the attributes for tenant models.
It seems to work only if the tenant database is a subset of the central database. This means I need to generate all tenant tables in the central database as well and then switch to the tenant database at request time. However, this feels more like a workaround rather than an ideal solution.
貢獻指南
評估
這個 Issue 還沒有評估資料。