Ed Zynda

Coder | Hacker | Superhero

Using Route/Model Binding In Laravel

Posted on · Tagged in

As I work more and more with Laravel, I keep running across some really cool time saving tricks. One of those time savers is route/model binding. Let’s say that you have the following route setup. <?php Route::get(‘books/{book}’, function($book) { return Book::find($book); }); That’s pretty simple right? Basically you point your browser at /books and then pass a book id and then use the ‘Book’ model to fetch that book from the database.…

Read more »
Subscribe to my newsletter and get a free copy of my book, Aspect Oriented Programming in PHP.