Astrotomic / laravel-translatable

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

I get unecessary foreach loop over all parent table for create/update translations table #378

Closed devcbash closed 7 months ago

devcbash commented 8 months ago

I am using the package with filament, I have a Recipe model and a RecipeTranslation

It is creating/updating the recipe_translations table fine, but I see in telescope that it is looping over the whole Recipes Table records instead of doing it by the RecipeResource recipe_id

select
  *
from
  `recipe_translations`
where
  `recipe_translations`.`recipe_id` = 1000
  and `recipe_translations`.`recipe_id` is not null

before the foreach it is doing:

select
  distinct `recipes`.*
from
  `recipes`
  left join `recipe_related_dish` on `recipes`.`id` = `recipe_related_dish`.`related_recipe_id`
github-actions[bot] commented 7 months 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