public function newFromBuilder($attributes = [], $connection = null)
{
if (is_object($attributes) && array_key_exists($attributes->post_type, static::$postTypes)) {
$class = static::$postTypes[$attributes->post_type];
} elseif (is_array($attributes) && array_key_exists($attributes['post_type'], static::$postTypes)) {
$class = static::$postTypes[$attributes['post_type']];
} else {
$class = get_called_class();
}
$model = new $class([]);
$model->exists = true;
$model->setRawAttributes((array) $attributes, true);
$model->setConnection($connection ?: $this->connection);
return $model;
}