I have just added a UUID for my users table.
I want to update all the records with a UUID that is unique.
In my seeder I have the following code that generates a UUID and populates this new column in the database. However, the generated UUID is the same in each row.
public function run()
{
DB::table('users')->update([
'public_id' => Uuid::generate(4)->string
]);
}
I would like the UUID to be generated for each user in the database. So each row has a unique UUID.