Astrotomic / laravel-translatable

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

Extension config for eager load #235

Closed sasha172017 closed 3 years ago

sasha172017 commented 3 years ago

Is your feature request related to a problem? Please describe. I have a problem, we need eager load ONLY. I need to write a withTranslations() for each query. Because in foreach loop l have query to database it`s a bad.

Describe the solution you'd like Add to config eagerLoad => true for all query

Gummibeer commented 3 years ago

Hey, I won't add a new config value. But you can do the same with the Laravel Eloquent model $with property. https://laravel.com/docs/8.x/eloquent-relationships#eager-loading-by-default

That way you can control all relations to load yourself.