Problem with surcharging models (tenancy case)
lcandellier opened this issue · 1 comments
Problem : i'm in multi-tenancy architecture with database by client. I've changed models in config to use supercharged models with connection forced on central database.
use Rinvex\Subscriptions\Models\Plan as parentPlan; class Plan extends parentPlan { protected $connection = 'central'; }
All is working, but when I call the recordFeatureUsage with a subscription on central database, the request try to persist on the tenant database.
Base table or view not found: 1146 Table 'tenant_17827c45-1a6c-456e-9f90-39b280ed9f62.plan_subscriptions' doesn't exist (SQL: select count(*) as aggregate from
plan_subscriptionswhere
id= 1)",
In function recordFeatureUsage, i've dumped $usage just before $usage->save() and it's on central connection
App\Models\Central\Admin\PlanSubscriptionUsage {#4462 #connection: "central"
Have you an idea ?