mardi 16 avril 2019

Get ID from new record in Laravel

I am creating a new user. After creating, I need the ID of the user, which is automatically set by the database.

$user = new User();
$user->save();
dd($user->id);

But the response I get is null. Is there a way to get the ID of the user?

I'm using Laravel version 5.8



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire