Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Conversation

@krydos
Copy link

@krydos krydos commented Jan 18, 2021

Hi,
thanks for keeping this package maintained. You saved lots of time for us and our project.

We've got one issue though. In our project we use applyTenantScopesToDeferredModels() method at the beginning of the app life circle. Then somewhere in the middle of that life circle we call \Landlord::removeTenant('tenant_id') which means we don't want to scope by a tenant_id for all the models we're going to use after the removeTenant call. But instead of not scoping we're getting exception saying that $tenant must be a string key or an instance of \Illuminate\Database\Eloquent\Model. It's all because tenant_id isn't available in tenants property of TenantManager class anymore but the scope was created already and it expects that tenant_id available.

This pull request fixes the issue. Let me know if the issue description isn't clear or the fix has other issues I didn't notice.

Thanks

@krydos
Copy link
Author

krydos commented Jan 18, 2021

Seems like I maybe should update applyTenantScopes as well

@krydos krydos force-pushed the dont-scope-by-removed-tenant branch from cdb3e8d to 179e3cb Compare January 18, 2021 17:47
@krydos
Copy link
Author

krydos commented Jan 22, 2021

CC @nunomazer

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant