You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since 5.7.15 (pull request #26622) the id of models, in some situations, is casted to int based only on the $incrementing value, disregarding $keyType.
This causes issues when the model has $keyType = 'string' and $incrementing = true.
In my case, I want to leave $incrementing as true because the id is being generated in the database as a default value (with the function gen_random_uuid()) but I still want Laravel to set the model id after inserting.
Granted, the meaning of 'incrementing' is being subverted to more of a 'being generated in the database', but, as far as I know, there is no other way to instruct Laravel to get the id of the inserted row and update the model with it.
The text was updated successfully, but these errors were encountered:
Since 5.7.15 (pull request #26622) the id of models, in some situations, is casted to int based only on the
$incrementing
value, disregarding$keyType
.This causes issues when the model has
$keyType = 'string'
and$incrementing = true
.In my case, I want to leave
$incrementing
astrue
because the id is being generated in the database as a default value (with the functiongen_random_uuid()
) but I still want Laravel to set the model id after inserting.Granted, the meaning of 'incrementing' is being subverted to more of a 'being generated in the database', but, as far as I know, there is no other way to instruct Laravel to get the id of the inserted row and update the model with it.
The text was updated successfully, but these errors were encountered: