Closed olivermbs closed 2 years ago
$category->getTranslationsArray()
[
'ca' => [
'name' => 'Anglès',
],
'en' => [
'name' => 'English',
],
'es' => [
'name' => 'Inglés',
],
];
https://docs.astrotomic.info/laravel-translatable/package/methods#gettranslationsarray
I'm also using Inertia&Vue
->getTranslationsArray()
Thank you! Do you send the translation array as a separate prop?
Do you send the translation array as a separate prop?
I'm including it with the other model values under the translations key to follow this:
https://docs.astrotomic.info/laravel-translatable/package/validation-rule-factory
This issue is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 7 days
Currently when eager loading the translations relationship on a model, the output is as follows:
The format I would like to use is the one which is produced by getTranslationsArray(), which comes out like this:
As I'm using InertiaJS/Vue, the second format is a lot easier to use in the templates. Is there any way to revert to this by default, without having to manipulate the eloquent result each time?
Thanks!