Tipoff
105
2
Laravel

Issue with Multiple Route Parameters

Posted 1 year ago by Tipoff

I am working on a route that looks like:


Route::get('quotes/{quoteauthor}/{quote}', '[email protected]');

It works, but it has an issue: When I visit any quote id, it will make the page appear behind an incorrect quote author. I notice the same issue here with the discussions on Laracasts:

https://laracasts.com/discuss/channels/laravel/issue-with-multiple-route-parameters https://laracasts.com/discuss/channels/vue/issue-with-multiple-route-parameters

Both of those show the same page, but one is an incorrect URL putting this discussion behind a channel where it does not exist. Is there a way to limit the second parameter to only show those items that have a relationship with the first model? How would I redirect the URL to the correct parameter on the first model?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.