Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

retrieve slug from slugs table if the $slugAttribute field was not changed #2688

Open
wants to merge 1 commit into
base: 3.x
Choose a base branch
from

Conversation

zeezo887
Copy link
Collaborator

@zeezo887 zeezo887 commented Nov 1, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

All module slugs get reset on reorder.
1 participant