This repository was archived by the owner on May 5, 2021. It is now read-only.
Don't scope by removed tenant #20
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 atenant_idfor all the models we're going to use after theremoveTenantcall. 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 becausetenant_idisn't available intenantsproperty ofTenantManagerclass anymore but the scope was created already and it expects thattenant_idavailable.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