Skip to content
New issue

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

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

Already on GitHub? # to your account

Restoring a translatable model tries to insert a new translation for the current locale #440

Open
vivere-dally opened this issue Feb 7, 2025 · 0 comments
Labels

Comments

@vivere-dally
Copy link

Describe the bug
I am trying to restore a model. MyModel::withTrashed()->find(id)->restore().

The saveTransactions method gets called with a translation object for the current locale, with empty attributes. It then tries to insert that into the table, failing.

To Reproduce

class MyModel extends Model implements TranslatableContract
{
    use Translatable;

    public $translatedAttributes = ['name', 'web_name'];
}

Expected behavior
I would expect the restore event to be correctly handled. It is probably handled in the same manner as saved/created events.

Versions (please complete the following information)

  • PHP: 8.1
  • Database: mysql
  • Laravel: 10.16
  • Package: 11.12
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Development

No branches or pull requests

1 participant