AdamWathan\Form\Elements\Checkbox::check PHP Method

check() public method

public check ( )
    public function check()
    {
        $this->unsetOldValue();
        $this->setChecked(true);
        return $this;
    }

Usage Example

Example #1
0
 public function testDefaultToUnchecked()
 {
     $checkbox = new Checkbox('above_18');
     $expected = '<input type="checkbox" name="above_18" value="1">';
     $result = $checkbox->defaultToUnchecked()->render();
     $this->assertEquals($expected, $result);
     $checkbox = new Checkbox('above_18');
     $expected = '<input type="checkbox" name="above_18" value="1" checked="checked">';
     $result = $checkbox->defaultToUnchecked()->check()->render();
     $this->assertEquals($expected, $result);
     $checkbox = new Checkbox('above_18');
     $expected = '<input type="checkbox" name="above_18" value="1" checked="checked">';
     $result = $checkbox->check()->defaultToUnchecked()->render();
     $this->assertEquals($expected, $result);
 }
All Usage Examples Of AdamWathan\Form\Elements\Checkbox::check