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.