in Laravel

Laravel Route Model Binding

This is one of my favourite features of Laravel routing and one of the features I see most underused, it's the model binding on the router. Let's think about the standard route you will create for say a User model. You'll have the standard crud routes in your application index, create, show, update and delete. The routes in your web.php routes file will look similar to below, using the ID of the user in the route so that we can collect the user model in the controller.

Upgrade to access all content on Paulund

Members unlock all tutorials and snippets

Access to all downloadable content

Access to code examples before others

Sign Up Now

Already a member? Login here

Subscribe To The Weekly Newsletter

Get weekly updates to your email