Closed sornss closed 3 years ago
This package was never tried with pivot tables as they behave totally differently. I would recommend you to use a real model if you want to use more complex logic on the intermediate table/model.
Well when I tried to use create on the Product's categorizable like below, the translation table was filled correctly:
$aProduct->categorizable()->create( [ "extra_title" => "An extra title", "category_id" => $anExistingCategory->id ] );
It is sufficient enough for me to proceed with the above approach. But I do prefer using attach via the Product's categories, and it looks better, no?
Please shed some light on this, if possible, why the translation is not loaded with attach.
Thank you.
Hey, I've source-dived it and attach()
doesn't use fill()
- the attributes take a long path:
So the attributes are set as raw attributes which just assigns the array to the $attributes
property.
The create()
method uses a different path:
So I will close this issue as there's nothing we could do here.
Hello gentlemen,
I have tried to translate a morphpivot relation (Categorizable, CategorizableTranslation) with the following schema, structure:
The related classes:
And I tried to attach an existing category to a product via the Product's categories as below:
$aProduct->categories()->attach($anExistingCategory, [ 'extra_title' => "An extra title" ]);
As result, the table categorizables is filled correctly but not the translation table categorizable_translations .
Any help and/or concerns please for the translation to be inserted as well in the translation table categorizable_translations ?