Get the Last Inserted Id Using Laravel Eloquent

Posted by LaravelIndia - 2 years ago

Laravel : Get last insert ID using Eloquent

$user           = new Model(User);
$user->name     = "John";
$user->age      = "28";
$user->save();

//Get last inserted id
$lastInsertedId = $user->id