4 years ago

Setting boolean model attributes with checkboxes

Posted 4 years ago by rhinodontypicus

Hi, guys. What do you think about this approach of setting boolean model attributes with checkboxes:

In model:

static::saving(function($thing) {
    $thing->field = $thing->field === 'on';


{!! Form::checkbox('field', null, !!$thing->field) !!}

On a scale from 0 to 10, where 0 - really bad, 10 - excellent, please vote for this code block.

Please sign in or create an account to participate in this conversation.