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.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.