Astrotomic / laravel-translatable

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

Trigger saving/saved event in the Translatable Model when changes are made in the Translation model #282

Closed davymaish closed 2 years ago

davymaish commented 2 years ago

Hi, thank you for the wonderful package.

Is there a way in which I can access the translatable model from the translation model. Example I have Post Model and PostTranslation Model. Normally if I want to access the PostTranslation object I would do $post->translations. Is the otherwise possible? Like $postTranslation->post or the like.

Also any changes made to the PostTranslation Model in the database does not trigger an upating/updated event to the Post Model. I have functions in the Post Model triggered in the boot() function dependent on the saving/saved event listener. My idea is that all changes made to PostTranslation Model to trigger event on the Post Model. Normally at $touches = [] attribute is normally used in laravel but I don't know how to impliment that on the PostTranslation model as i don't know how to point to the Post Model.

Thank you in advance.

github-actions[bot] commented 2 years ago

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