private function getCheckboxCheckedState($name, $value, $checked)
    {
        if (
            isset($this->session) &&
            ! $this->oldInputIsEmpty() &&
            is_null($this->old($name))
        )
            return false;

        if ($this->missingOldAndModel($name))
            return $checked;

        $posted = $this->getValueAttribute($name, $checked);

        if (is_array($posted))
            return in_array($value, $posted);

        if ($posted instanceof Collection)
            return $posted->contains('id', $value);

        return (bool) $posted;
    }