From 5470cbe228c680e8accd375547db4e76260d03f1 Mon Sep 17 00:00:00 2001 From: Abishek R Srikaanth Date: Fri, 23 Sep 2022 01:39:48 +0530 Subject: [PATCH] Fixing the model name of the complex secondary models --- source/docs/v3/single-database-tenancy.blade.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/docs/v3/single-database-tenancy.blade.md b/source/docs/v3/single-database-tenancy.blade.md index d4f12aa..acf39c7 100644 --- a/source/docs/v3/single-database-tenancy.blade.md +++ b/source/docs/v3/single-database-tenancy.blade.md @@ -24,7 +24,7 @@ In single-database tenancy, there are 4 types of models: - primary models — models that **directly** belongTo tenants - secondary models — models that **indirectly** belongTo tenants - e.g. **Comment** belongsTo **Post** belongsTo **Tenant** - - or more complex, **Vote** belongsTo **Tenant** belongsTo **Post** belongsTo **Tenant** + - or more complex, **Vote** belongsTo **Comment** belongsTo **Post** belongsTo **Tenant** - global models — models that are **not scoped** to any tenant whatsoever To scope your queries correctly, apply the `Stancl\Tenancy\Database\Concerns\BelongsToTenant` trait **on primary models**. This will ensure that all calls to your parent models are scoped to the current tenant, and that **calls to their child relations are scoped through the parent relationships**.