JoeMaher's avatar

Nested resources more than 2 deep throwing 404's with MySQL.

So, strange issue I’m having with nested resources in 5.1, I have a route defined as groups.feeds.images with route model binding for groups, feeds and images. Now locally, using sqlite and the built in artisan serve, if I hit {url}/groups/1/feeds/1/images/1 I get the resource I am after, but on our production server running ngix and mysql, we get a resource not found. Now this only seems to happen with nested resources that are more than 2 deep, {url}/groups/1/feeds/1 works fine, so does {url}/groups/1/feeds/1/images/. Any ideas fellow Laravists?

0 likes
6 replies
JoeMaher's avatar

Bump, anyone experienced this before, got any ideas?

helmerdavila's avatar

You can use

dd( $myVariable )

when you return that image to see the full route, check if working fine, else maybe can be nginx configuration and the url patterns.

JoeMaher's avatar

Something is getting stuffed up during the route-model binding process as far as I can tell, it cannot find the image with the given ID when using MySQL, however locally using sqlite, it works. As originally expressed though, only happens when the model binding is nested more than 2 deep.

helmerdavila's avatar

Yeah, but 404 says, that maybe the route from image not mach with your request to nginx to find the image.

Please or to participate in this conversation.