Closed andrewmclagan closed 3 years ago
Is there a public method available for converting a uuid or array of uuids into bytes?
uuid
for example an app could create a bunch of posts with uuid on the client side:
[ { uuid: '40b5a3ab-0154-4543-a442-f987c50a463d', title: 'Test post 1' }, { uuid: '9128d630-2629-4f42-b038-1d9d0e8124df', title: 'Test post 2' }, { uuid: '9ba7002b-4a68-41a3-a5b0-041c250e234a', title: 'Test post 3' }, ]
How does one covert those to bytes? Some may exist in the DB others may not, need a way to do
->whereIn('uuid', $uuids) ->whereNotIn('uuid', $uuids)
->whereIn('uuid', $uuids)
->whereNotIn('uuid', $uuids)
etc...
All the current methods rely on a model instance which of course one may never have. Is that not the point of UUIDs? That client side can create the id?
A helper could be useful, Uuid::toBytes($uuids); Or Uuid::fromBytes($uuids)
Uuid::toBytes($uuids);
Uuid::fromBytes($uuids)
I've not tested it, but does the custom cast from the laravel-efficient-uuid package not handle this automatically?
laravel-efficient-uuid
Is there a public method available for converting a
uuid
or array ofuuid
s into bytes?for example an app could create a bunch of posts with
uuid
on the client side:How does one covert those to bytes? Some may exist in the DB others may not, need a way to do
->whereIn('uuid', $uuids)
->whereNotIn('uuid', $uuids)
etc...
All the current methods rely on a model instance which of course one may never have. Is that not the point of UUIDs? That client side can create the id?
A helper could be useful,
Uuid::toBytes($uuids);
OrUuid::fromBytes($uuids)