Friday, March 3, 2017

Laravel set default value from value in database

How do you create a form for editing existing records in Laravel where the current values in the database are used for the defaults in input and select fields?

P.S. I'm posting this question to answer it myself, so that if I ever forget that this is called "model binding" again, I won't have to search for an hour to remember the correct syntax for it. (If you don't search under "model binding", this used to be really hard to find for some reason :P)



via Skeets O'Reilly

Advertisement