Transformers
What are the available transformers?
| Class |
Description |
\Aero\Admin\Transformers\AttributesTransformer |
This transformer is used in the ProductTransformer to transform the product's attribute groups. |
\Aero\Admin\Transformers\BaseTagTransformer |
This transformer is used to generate the data for a new tag. |
\Aero\Admin\Transformers\BaseVariantTransformer |
This transformer is used to generate the data for a new variant. |
\Aero\Admin\Transformers\DiscountTransformer |
This transformer is used to transform a discount for the discount new/edit page. |
\Aero\Admin\Transformers\ProductTransformer |
This transformer is used to transform a product for the product new/edit page. |
\Aero\Admin\Transformers\TagsTransformer |
This transformer is used to transform tags for the tag group new/edit page. |
\Aero\Admin\Transformers\TagTransformer |
This transformer is used to transform a tag in the \Aero\Admin\Transformers\TagsTransformer. |
\Aero\Admin\Transformers\VariantTransformer |
This transformer is used in the ProductTransformer to transform the product's variants. |
How do I add custom data to a transformer?
You can add a custom field using the add() method and returning an array:
\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:
\Aero\Admin\Transformers\ProductTransformer::addCast('acme', 'integer');