-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modify tenant id in after middleware? #52
Comments
Some clarification. Is it possible to change this functionality around, to be more similar to how it was done in the AURA package? Where it just applied the "where" to the Eloquent Builder. |
In regards to this issue, the problem still exists, but we've worked around it, and went through our callstack, and made certain nothing can get booted before it's needed and the middleware scope has run. Also had to implement the change from this PR to fix the other issue. |
I have an issue where the app already boots User model, calling bootBelongsToTenants() after doesn't seem to fix it. |
@MrRio , i'd advise doing "throw new ErrorException" in the boot-method of your user object, and trace through the call stack to see where the model is being booted BEFORE the middleware is booted. Possibly even adding some Log::info() in the middleware doing the scope, and the boot-method, so you can verify it's not being booted beforehand. |
Hey,
It seems like it's not possible to modify the Tenant ID after it's been set once.
Currently we're setting in a Scope Middleware, that's globally applied, and it works perfectly.
But we have a few instances where we'd like to change/modify the Tenant ID to be something else, if we need to run artisan commands or other console related commands.
This is what i've tested with:
`\DB::enableQueryLog();
And this is the response i'm getting:
As seen, the Tenant ID is the same for all of them, except after i've called "allTenants()", it correctly removed the tenant-scope, but that's not what i want to achieve.
Is this an issue with this package, or something deeper in Eloquent's way of handling the global scopes?
In addition to this, Disable() does not seem to make any difference at all either.
The text was updated successfully, but these errors were encountered: