Hi
In BinaryUuidSupportableTrait.php file I found this:
/**
* Returns string form of UUID.
*
* @throws Exception
*
* @return string
*/
public function uuid(): string
{
$uuid = $this->getUuidColumn();
if (!isset($this->$uuid)) {
throw new AccessedUnsetUuidPropertyException(
'Cannot get UUID property for not saved model'
);
}
return Uuid::fromBytes($this->$uuid)->toString();
}
However instead $this->$uuid shouldn't be $uuid instead?
If I leave like that then everytime is searching after 'id' column and not the 'uuid' column.
Second thing is when I am trying to save data then I get this error message:
Ramsey\Uuid\Exception\InvalidArgumentException
$bytes string should contain 16 characters.
at vendor\ramsey\uuid\src\Codec\StringCodec.php:88
84▕
85▕ public function decodeBytes(string $bytes): UuidInterface
86▕ {
87▕ if (strlen($bytes) !== 16) {
➜ 88▕ throw new InvalidArgumentException(
89▕ '$bytes string should contain 16 characters.'
90▕ );
91▕ }
92▕
1 vendor\ramsey\uuid\src\UuidFactory.php:269
Ramsey\Uuid\Codec\StringCodec::decodeBytes("uuid")
2 vendor\ramsey\uuid\src\Uuid.php:466
Ramsey\Uuid\UuidFactory::fromBytes("uuid")
It is my code:
$generalcat = new Category();
$generalcat->type = 'Tickets';
$generalcat->save();
$this->generalcatuuid = $generalcat->uuid();
$generalcat->translate_category()->saveMany([
new CategoryTranslation([
'lang_code' => 'en',
'value' => 'General'
]),
new CategoryTranslation([
'lang_code' => 'hu',
'value' => 'Átlagos'
]),
new CategoryTranslation([
'lang_code' => 'se',
'value' => 'Allmän'
])
]);
So I am saving the category record first and after I want to save in the different table the translations.
However it seems the Ramsey package wants to be used either way.
I deleted the ramsey package usage from the category and category translation models so originally shouldn't be used.
No idea what can be the problem. I am using Laravel 11.30.0.
Thanks in advance for the help.
Hi
In BinaryUuidSupportableTrait.php file I found this:
However instead $this->$uuid shouldn't be $uuid instead?
If I leave like that then everytime is searching after 'id' column and not the 'uuid' column.
Second thing is when I am trying to save data then I get this error message:
It is my code:
So I am saving the category record first and after I want to save in the different table the translations.
However it seems the Ramsey package wants to be used either way.
I deleted the ramsey package usage from the category and category translation models so originally shouldn't be used.
No idea what can be the problem. I am using Laravel 11.30.0.
Thanks in advance for the help.