composer.json
by executing the command.locales
your app should use.Post
. We will need an extra table post_translations
:Post
should use the trait Astrotomic\Translatable\Translatable
. The default convention for the translation model is PostTranslation
. The array $translatedAttributes
contains the names of the fields being translated in the PostTranslation
model.ChildPost
that inherits from Post
class, but has the same database table as its parent.post_translations
table using foreign key child_post_id
according to Laravel. So, in this case, you will have to change the property $translationForeignKey
to your 'post_id'
.