Duplicated tags in database #434
Unanswered
beataburczyk
asked this question in
Bugs
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Not sure if this is intentional (I don't think so) or maybe Readme file is missing with some important information about MariaDB.
My setup:
Laravel: 9.42.2
PHP: 8.1.12
MariaDB: 10.7.3-MariaDB-1:10.7.3+maria~focal
I have seed db with new tags and their translations, at this point all was fine I have resulted with few items in db with eg. name:
name => {'pl':'obiad', 'en':'dinner'}
Then, when try to seed products using:
'tags' => ['obiad']
I result with new tag in database (what is not correct to me, is a duplication)
name => {'pl':'obiad'}
My app locale is set to 'pl' as you can spot from order of translation, so during the tag seeding I had:
$tag = Tag::findOrCreate('obiad');
$tag->setTranslation('name', 'en', 'dinner');
$tag->save();
Due to construction of my product model via factory i was using this part of docs to add tags:
$newsItem = NewsItem::create([
'name' => 'The Article Title',
'tags' => ['first tag', 'second tag'], //tags will be created if they don't exist
]);
'//tags will be created if they don't exist' - this part fails, in my case create tag even if it exists, no error just new items in DB
Will appreciate any explanation of this behaviour. Thanks in advance!
Beata
Beta Was this translation helpful? Give feedback.
All reactions