api-platform / api-platform/core
[Laravel] Multi-tenancy support
- Linguagem predominante
- PHP
- Estrelas
- 2.6k
- Forks
- 980
- Merge médio
- 2d 5h
- PRs com merge (30d)
- 48
Descrição
**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.
Guia de contribuição
Avaliação
Esta issue ainda não foi avaliada.