Open rikvdlooi opened 6 years ago
When you scope on multiple tenants Landlord, landlord will use the id of the first tenant on all other tenants.
id
How to reproduce (some 'pseudo' code):
Model with two different tenants
class MyModel extends Model { use BelongsToTenants; public $tenantColumns = ['tenant_a_id', 'tenant_b_id']; }
Add Tenants
Landlord::AddTenant('tenant_a_id', 1); Landlord::AddTenant('tenant_b_id', 2);
Get results
MyModel::all();
If you use barryvdh/laravel-debugbar you can see that the query will be like this:
select * from my_model where tenant_a_id = 1 and tenant_b_id = 1;
The $id for Tenant A is also used for the scope of Tenant B.
$id
I think this is the same case as #85
Yes @aluferraz. It looks like it is the same issue. At least (almost) the same solution.
@HipsterJazzbo any thoughts on this ? :)
When you scope on multiple tenants Landlord, landlord will use the
id
of the first tenant on all other tenants.How to reproduce (some 'pseudo' code):
Model with two different tenants
Add Tenants
Get results
If you use barryvdh/laravel-debugbar you can see that the query will be like this:
The
$id
for Tenant A is also used for the scope of Tenant B.