protected $_adminType = 'checkbox';
protected $_databaseType = 'boolean';
protected $_columnType = 'check';
+ protected $_cast = 'boolean';
}
protected $_rules = [];
protected $_adminType = 'text';
protected $_databaseType = 'text';
+ protected $_cast = false;
protected $_databaseUnique = false;
protected $_databaseIndex = false;
protected $_translatable = false;
+
protected $_databaseAttributes = [];
/**
{
return ['type' => $this->_adminType, 'column' => false, 'form' => 'both', 'rules' => '',
'fillable' => true, 'guarded' => false, 'hidden' => false, 'translatable' => $this->_translatable,
- 'column_type' => 'text', 'default' => ''];
+ 'column_type' => 'text', 'default' => '', 'cast' => $this->_cast];
}
public function __construct($attributes)
return null;
}
+
protected function _postSetAttributes()
{
/** @var Field $field */
$field = Field::getInstance($attributes);
if (null !== $field->getRelationship()) {
- $this->_addRelationship($field);
+ $continue = $this->_addRelationship($field);
+ if (!$continue) {
+ return;
+ }
}
$name = $field->getAttribute('name');
if ($field->getAttribute('translatable')) {
$this->translatable[] = $name;
}
+
+ if ($field->getAttribute('cast', false) !== false) {
+ $this->casts[$field->getAttribute('name')] = $field->getAttribute('name');
+ }
}
/**