logo

Route binding with two different models

Let the framework do the heavy lifting

Joel Clermont
Joel Clermont
2026-02-27

What if you need a single URL that could resolve to either a Post or a Page? You could handle it manually in the controller, or reach for polymorphic relationships, but there's a simpler option.

In this video, I walk through using Laravel's explicit route model binding to elegantly solve this problem with just a few lines of code.

Watch Now (5 min)

And after watching, don't forget to subscribe to our YouTube channel, so you don't miss future videos.

Here to help,

Joel

P.S. Have a question about route model binding or anything else in Laravel? The Mastering Laravel community is a great place for this kind of discussion.

Toss a coin in the jar if you found this helpful.
Want a tip like this in your inbox every weekday? Sign up below 👇🏼
email
No spam. Only real-world advice.