"Curiosity is the very basis of education and if you tell me that curiosity killed the cat, I say only the cat died nobly." - Arnold Edinborough

I really enjoy how easy Laravel makes forms. Being able to pass in a model to Laravel and have it take care of everything is awesome. Sometimes I simply don’t want to make a whole model for my form data, though. If you are similarly lazy at times then there’s a simple way to still have your default form values based on previous input.

Simply create a StdClass object and store the input values in there.

$sorting = new StdClass;
$sorting->sort_by     = Input::get('sort_by', 'displayname');
$sorting->sort_order  = Input::get('sort_order', 'asc');
$sorting->sort_region = Input::get('sort_region', 'all');

Pass $sorting to your template and use it with Form::model() and you’re good to go.


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>