Closed rmatson-bst closed 8 years ago
After doing some more research I finally found that the route model binding is applied before the route middleware is applied which is exactly what my issue is. According to the posts below Laravel is working as designed so I can't set this up the way I thought I could.
Here's the posts as reference: https://github.com/laravel/framework/issues/6118
@rdmatson Any simple workaround here?
The simple work-around for me was to take out the route-model binding and simply call the findOrFail() directly instead. Once inside the method and everything from the framework was applied Landlord worked correctly. Reading through the post I referenced and having this issue makes me side with the people questioning the order of operations by the framework, but at least there seems to be a work-around for this case.
@rdmatson Okay, all right. I already did so and replaced all that resource routings with manual routing and find method :)
Hello,
I just started using Landlord for a new project and things were going well until I started using Laravel's route model binding. When using route model binding I have any record returned whether part of the tenant's records or not when using route model binding. If I simply pass the id into the function and perform my own findOrFail($id) then everything works as it should and trying to access those records not part of the tenant's fail. I have a middleware class that sets the tenant applied on the Route::group as only some of my routes need multi-tenant support.
My guess is that I'm implementing something incorrectly, but I'd like to know if this is a workable configuration or I simply can't used route model binding.