Same type of route skip if no model found?

Posted 9 months ago by Shirshak

Suppose my route looks like this

Route::get('/{page_slug}','[email protected]');
// and in controller there is implicit route binding

Route::get('/{username}','[email protected]');
// in controller there is implicity route binding

The problem is if pages don't exist it will immediately show 404 pages . Is there any simple way if there is no pages with page slug move to username and even if username is not found then skip to another.


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.