laravel/framework — pull request #3572 by RyanNielson (2014-02-16 05:08:10+00:00)
Title: Automatically add hidden input fields alongside checkboxes

This commit is based on my blog post here: http://nielson.io/2014/02/handling-checkbox-input-in-laravel/

Basically, it automatically adds a hidden input field alongside checkboxes to make saving of unchecked checkboxes easier on the server side. This idea is used extensively in other frameworks like Ruby on Rails, and seems to help simplify form creation.

I added the uncheckedValue parameter after $options, which seems to break the standard of options being last. Although, this seemed to be the only way to handle this issue without breaking backwards compatibility. I wasn't sure if adding this to $options was a problem, so I kept it on it's own. Ideally it would be next to $value in the parameters list to maintain $options placement, but this would break backwards compatibility.

I'm open to any suggestions on other ways to write/improve this code.