Wednesday, March 15, 2017

[SOLVED]UUID as primary key not working Laravel

We've using UUID as primary key in laravel, I've created a record and its working but I've unable to get this record with UUID.
Table:
CREATE TABLE `User` (
  `uuid` binary(16) NOT NULL ,
  `name` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`uuid`),
) ;

Laravel code:
$contact = User::find(hex2bin('11E7094BFDB648529F5F7429AF41FD58'));

But result is always Null. :(
Thanks!


via Govind Samrow

Advertisement