public __construct ( object $attributes = null, array $options = [] ) | ||
$attributes | object | Attributes of this model |
$options | array | Options with which to configure this model |
public function __construct($attributes = null, array $options = [])
{
if (is_object($attributes)) {
$this->attributes = $this->parseAttributes($attributes);
if (isset($this->attributes->id)) {
$this->id = $this->attributes->id;
}
} else {
$this->attributes = (object) [];
}
}
/** * @inheritdoc */ public function __construct($attributes = null, array $options = []) { parent::__construct($attributes, $options); $this->organization = $options['collection']->organization; $this->site_data = $attributes->site; $this->tags_data = $attributes->tags; }