[Question] Fake field and translations
See original GitHub issueI wonder about translatable and the fake field functionality. Currently to create a translatable fake field you have to mark the entire column as translatable. This makes it impossible for a fake column to contain both translated and untranslated content. For example SEO/OpenGraph meta information: meta_title
,meta_description
and meta_keywords
should all be translatable, but meta_image
is (almost always) the same for any language. From a practical standpoint (also looking at potential overhead when using a mixed translatable/non translatable fake field situation) it would be more logical if a fake field would store it’s “faked” translated information per field inside the fake column (maybe through a configuration property)… Combining this with the “withFakes” option and a slightly modified “HasTranslations” should provide enough flexibility to mix-and-match translated/untranslated fields inside a single fake column…
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (6 by maintainers)
Hello guys,
This comment doesn’t work on backpack/crud
4.0.23
, Laravel6.6.0
The only think you should change is that you don’t have to cast'extras_translatable'
toarray
. Everything else works just fine. Thank @promatik for your answer. I just mention that because it took me hours to realize that.Cheers
@lloy0076 you were right, I solved it without any coding, just by adding
'extras_translatable'
to$fillable
,$fakeColumns
and$translatable
, and cast'extras_translatable'
toarray
.Also, when adding field, store the field in
extras_translatable
.And it’s done!