-
Notifications
You must be signed in to change notification settings - Fork 29
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
Tenant Route Model binding not working? #18
Comments
Looks like you’re missing the BelongsToTenant trait on your products model.
…On Sat, May 18, 2019 at 13:12 Devon Mather ***@***.***> wrote:
Hey All,
I'm trying to dig into this but running into a few issues. I might be
missing something as this seems like something that would work out of the
box based on the documentation.
Currently, I have a product owned by Tenant 1
http://tenant1.exampledomain.test/products/2
If I then log in as Tenant 2 and navigate to this URL
http://tenant2.exampledomain.test/products/2
Then I can see the contents of that product, although I assume I shouldn't?
Quick run down as per the docs;
- Register
RomegaDigital\Multitenancy\MultitenancyServiceProvider::class in
config/app.php
- Run php artisan multitenancy:install
- Add HasTenants, HasRoles to User model
- Add 'tenant.auth' =>
\RomegaDigital\Multitenancy\Middleware\TenantMiddleware::class to
routeMiddleware in app/Http/Kernel.php
- I have then wrapped by routes in the route group as below
Route::resource('/products', 'ProductController');
});```
Am I missing something, or does tenant route model binding not work out of the box?
Thanks for any feedback, and let me know if I can provide more helpful info to debug.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#18>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABVRITAMGI57IN5SDPAYTLPWA2JHANCNFSM4HN2WMHA>
.
|
Thanks for replying to this on the weekend. I can confirm the trait is on the model. I have echoed out the apply method to see if it was exiting early or anything.
That results in the following output "reached 1, reached 1, reached 2, reached 3, reached 5," For some reason the addGlobalScope function is not being invoked? |
Is there any reason this function would be skipped?
|
When setup correctly, I can't imagine an instance where that'd be the case. If you are able to provide a repo of your code, I can review it and see where things are going wrong! |
Hey All,
I'm trying to dig into this but running into a few issues. I might be missing something as this seems like something that would work out of the box based on the documentation.
Currently, I have a product owned by Tenant 1
http://tenant1.exampledomain.test/products/2
If I then log in as Tenant 2 and navigate to this URL
http://tenant2.exampledomain.test/products/2
Then I can see the contents of that product, although I assume I shouldn't?
Quick run down as per the docs;
Am I missing something, or does tenant route model binding not work out of the box? My expectation here would be a 403 response to the user.
Thanks for any feedback, and let me know if I can provide more helpful info to debug.
The text was updated successfully, but these errors were encountered: