Laravel’s route model binding is a very powerful feature. First of all, let’s take a look, how to bind a contract to a model in the container. This is a very simple process, all we need to do is call the bind() method in our service provider.
So, let’s create an explicit route-model binding in one of our service providers, but instead of resolving a model directly, let’s use the container to get the bound implementation: So in our routes, we can type-hint our contract and it’ll return with the desired model property: You may ask, why is this even useful? Well, most of the cases this is not the best pattern we can go for, however, sometimes this can provide an extra layer of flexibility.