# Transformers

# What are the available transformers?

<table border="1" id="bkmrk-class-description-%5Ca" style="border-collapse: collapse; width: 100%; height: 268.172px;"><colgroup><col style="width: 50%;"></col><col style="width: 50%;"></col></colgroup><tbody><tr style="height: 29.7969px;"><td style="height: 29.7969px;">**Class**  
</td><td style="height: 29.7969px;">**Description**  
</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">`\Aero\Admin\Transformers\AttributesTransformer`</td><td style="height: 29.7969px;">This transformer is used in the ProductTransformer to transform the product's attribute groups.</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">`\Aero\Admin\Transformers\BaseTagTransformer`</td><td style="height: 29.7969px;">This transformer is used to generate the data for a new tag.</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">`\Aero\Admin\Transformers\BaseVariantTransformer`</td><td style="height: 29.7969px;">This transformer is used to generate the data for a new variant.</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">`\Aero\Admin\Transformers\DiscountTransformer`</td><td style="height: 29.7969px;">This transformer is used to transform a discount for the discount new/edit page.</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">`\Aero\Admin\Transformers\ProductTransformer`</td><td style="height: 29.7969px;">This transformer is used to transform a product for the product new/edit page.</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">`\Aero\Admin\Transformers\TagsTransformer`</td><td style="height: 29.7969px;">This transformer is used to transform tags for the tag group new/edit page.</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">`\Aero\Admin\Transformers\TagTransformer`</td><td style="height: 29.7969px;">This transformer is used to transform a tag in the `\Aero\Admin\Transformers\TagsTransformer`.</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">`\Aero\Admin\Transformers\VariantTransformer`</td><td style="height: 29.7969px;">This transformer is used in the ProductTransformer to transform the product's variants.</td></tr></tbody></table>

# How do I add custom data to a transformer?

You can add a custom field using the `add()` method and returning an array:

```php
\Aero\Admin\Transformers\ProductTransformer::add(function ($data) {
   /* @var \Aero\Catalog\Models\Product */
   $product = $data['product'];

   return [
       'foo' => 'bar',
   ];
});
```

You can add a cast using the `addCast()` method:

```php
\Aero\Admin\Transformers\ProductTransformer::addCast('acme', 'integer');
```