Setting the locale key to empty array by default

parent 409f56ac
...@@ -57,6 +57,7 @@ class MediaTransformer extends Resource ...@@ -57,6 +57,7 @@ class MediaTransformer extends Resource
} }
foreach (LaravelLocalization::getSupportedLocales() as $locale => $supportedLocale) { foreach (LaravelLocalization::getSupportedLocales() as $locale => $supportedLocale) {
$data[$locale] = [];
foreach ($this->translatedAttributes as $translatedAttribute) { foreach ($this->translatedAttributes as $translatedAttribute) {
$data[$locale][$translatedAttribute] = $this->translateOrNew($locale)->$translatedAttribute; $data[$locale][$translatedAttribute] = $this->translateOrNew($locale)->$translatedAttribute;
} }
......
...@@ -19,6 +19,7 @@ class FullPageTransformer extends Resource ...@@ -19,6 +19,7 @@ class FullPageTransformer extends Resource
]; ];
foreach (LaravelLocalization::getSupportedLocales() as $locale => $supportedLocale) { foreach (LaravelLocalization::getSupportedLocales() as $locale => $supportedLocale) {
$pageData[$locale] = [];
foreach ($this->translatedAttributes as $translatedAttribute) { foreach ($this->translatedAttributes as $translatedAttribute) {
$pageData[$locale][$translatedAttribute] = $this->translateOrNew($locale)->$translatedAttribute; $pageData[$locale][$translatedAttribute] = $this->translateOrNew($locale)->$translatedAttribute;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment