/** * Convert the eloquent 'object' into an alchemy model. * * @param Object $object * @return Model */ public function transformObjectToModel(Object $object) { $object->load('values', 'values.attribute'); $attributes = []; foreach ($object->values as $value) { $attributes[$value->attribute->name] = $value->content; } return $this->newAlchemyModel($attributes, $object->id); }