Astrotomic / laravel-translatable

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

How to get only translations of the current locale? #270

Closed nunowar closed 2 years ago

nunowar commented 2 years ago

Hi.

I would like to get only translations of the current locale.

I use: protected $with = ['translations']; to eager load, but I would like to know if it's possible to get only the current locale translations.

Thanks.

sdn1364 commented 2 years ago

Hi, I have the same problem. there are a lot of unnecessary models loaded in page

Gummibeer commented 2 years ago

https://github.com/Astrotomic/laravel-translatable/blob/6f2e3855836d46ab7ad3dabd269a400404f8b42c/src/Translatable/Traits/Relationship.php#L64-L69

This one should be reworked to a hasOne()->ofMany() relationship in the future - but it works.

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