twill
twill copied to clipboard
retrieve slug from slugs table if the $slugAttribute field was not changed
Description
The changes made here was to use the previous slug value if the $slugAttribute field was not changed. By doing this, we won't have duplicate slug entries when a model is not updated via the repository.
/**
* Returns changed value of slugAttribute field or previous slug value
*/
private function getSlugValue($slugAttribute, $locale): mixed
{
return $this->wasChanged($slugAttribute)
? $this->$slugAttribute
: $this->slugs()->where('locale', $locale)
->where('active', true)->value('slug');
}
Related Issues
Fixes #2681
Is the disableLocaleSlug even needed before? This seems to be done already in updateOrNewSlug and I'm sure it's interfering with getOldSlug->active