jeudi 28 avril 2016

Laravel 5, can't get the ID of the just saved model, when using UUID

I'm using Laravel Eloquent for my posts table and using the UUID for my table's primary key. But after saving the model I can't get the ID of it, although all the values are correctly inserted in database.

$post = new App\Post();
$post->uuid  = \Webpatser\Uuid\Uuid::generate();
$post->save();
dd($post->uuid); //return null or 0

adding accessors or using $post->getKey() could not solve my problem.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1rBpk1P
via IFTTT

Aucun commentaire:

Enregistrer un commentaire