Press "Enter" to skip to content

Route binding, Type hinting and Clean coding – Laravel

Now, watch carefully. This is how it’s done.

Step 1: In your route file web.php

Step 2: In your Service provider (probably RouteSeviceProvider.php)

Step 3: Finally in your controller (BookController.php)

Step 4: Now, in your view file,


This single form is able to handle both of your new books and updates an old book scenario.

If you hit route book/create, you will get a form to create a new book. The controller would receive a new instance of Book model and it would be saved.

If you hit route book/1, you will get a form to update the book with ID of 1. Here, Controller would receive the instance of Book but this time, a book of ID 1 has been retrieved.

If you hit route book/{something}, you will have a 404 error(because it does not exists).

Keep in mind, that this idea is only tested in Laravel 5.6. Check this post to know more about Laravel 5.6.


Everything is awesome.


  1. You made some good points there. I looked on the internet for additional information about the issue
    and found most individuals will go along with your views on this

  2. Hey there! I just would like to offer you a big thumbs up for the
    great info you have got right here on this post.
    I’ll be coming back to your web site for more soon.

  3. Thanks for ones marvelous posting! I seriously enjoyed reading it, you can be a great author.
    I will remember to bookmark your blog and will often come back later in life.
    I want to encourage you to definitely continue your great work,
    have a nice morning!

  4. Sling TV
    Sling TV November 15, 2018

    I’m really enjoying the theme/design of
    your site. Do you ever run into any web browser compatibility issues?
    A couple of my blog readers have complained about my site
    not working correctly in Explorer but looks great in Chrome.
    Do you have any tips to help fix this issue?

  5. Sling TV
    Sling TV November 15, 2018

    When someone writes an piece of writing he/she
    retains the idea of a user in his/her mind that how a user can be aware of
    it. Therefore that’s why this piece of writing
    is great. Thanks!

  6. It is appropriate time to make a few plans for the future and it is time to be
    happy. I have learn this publish and if I could I want to counsel
    you some attention-grabbing things or suggestions. Maybe you could write next articles relating to this article.

    I desire to learn more issues approximately it!

  7. Sling tv coupons and promo codes for november 2018
    Fantastic goods from you, man. I have keep in mind your stuff prior to and you’re just too excellent.

    I actually like what you’ve received right here, certainly like what you’re stating and the way by which you
    are saying it. You’re making it entertaining and you continue to take care of to keep it sensible.
    I cant wait to read far more from you. That is actually a wonderful web site.
    Sling tv coupons and promo codes for november 2018

  8. Sling tv coupons and promo codes for november 2018
    If some one wishes expert view on the topic of blogging and
    site-building afterward i recommend him/her to go to see this
    blog, Keep up the nice job. Sling tv coupons and promo codes
    for november 2018

  9. Unquestionably believe that which you said. Your favorite justification appeared to be on the web the simplest
    thing to be aware of. I say to you, I certainly get irked while people think about worries that they plainly do not know about.
    You managed to hit the nail upon the top and defined out the whole thing without having side effect , people can take a signal.
    Will likely be back to get more. Thanks

  10. I do not even know how I ended up here, but I
    thought this post was good. I do not know who you are
    but definitely you are going to a famous blogger if you are not already ;
    ) Cheers!

Leave a Reply

Your email address will not be published.