When I first started working with Laravel, one of the very first piece of code that I came across was similar to following: So when I went to URL /post/1, the Post with id 1 was available inside the controller as variable $post. If I entered a URL with id that did not existed in the Database, I was even redirected to a 404 Page.
Later on I came to know that this particular feature is known as Route Model Binding.
Without Route Model Binding, our code would have looked something as follows: With Route Model Binding, it is super compact without affecting the readability.
We then need to tell Router that we are going to use Explicit Binding for this Route.