outl1ne / nova-translatable

A Laravel Nova package that allows you to make any input field translatable.
MIT License
199 stars 56 forks source link

Use Arrayable interface when casting to array #134

Closed jan-tricks closed 1 month ago

jan-tricks commented 1 month ago

This pull request enables the use of spatie/data in conjunction with attribute casting.

Spatie's BaseData implements - like many other classes - Laravel's Arrayable Interface. This makes the toArray() method available, which can (and maybe should) be used instead of (array). In this way, only the desired values of the attribute become part of the array instead of casting the internal structures as well.

Tarpsvo commented 4 weeks ago

Thanks a ton! Merged and released. :)