*/
protected $_options = [];
+ private $__attributes;
+
public function __construct(array $attributes = [])
{
- parent::__construct($attributes);
+ $this->__attributes = $attributes;
$this->init();
}
- public function init()
+ protected function init()
{
-
+ $this->bootIfNotBooted();
+ $this->initializeTraits();
+ $this->syncOriginal();
+ $this->fill($this->__attributes);
}
public function getOption($key, $default = null)
$field = Field::getInstance($attributes);
$name = $field->getAttribute('name');
$this->_fields[$name] = $field;
- $this->fillable[] = $name;
+
+ if ($field->getAttribute('fillable')) {
+ $this->fillable[] = $name;
+ }
+ if ($field->getAttribute('guarded')) {
+ $this->guarded[] = $name;
+ }
+ if ($field->getAttribute('hidden')) {
+ $this->hidden[] = $name;
+ }
}
public function generateCode()