Astrotomic / laravel-translatable

A Laravel package for multilingual models
https://docs.astrotomic.info/laravel-translatable/
MIT License
1.25k stars 157 forks source link

Store model translation in a module #212

Closed YaroslavFedan closed 3 years ago

YaroslavFedan commented 3 years ago

Good afternoon, I am writing a CMS. The project structure that I decided to choose is modular. But there is a problem with using this package. Unfortunately, I did not find (did not come up with) a way to isolate the translation models in the module, I have to create them in the root directory, which is specified in the config file, is it possible to isolate them in the module?

Gummibeer commented 3 years ago

You can define $translationModel property on the translatable model which should contain the FQCN to your translation model. This way you are totally free where you place it and how you name it.

https://github.com/Astrotomic/laravel-translatable/blob/d853a3c34be42941dc83c5cddd9e1e98c71abae1/src/Translatable/Traits/Relationship.php#L25-L28