In case you are using save()

$blog = new Blog;
$blog->title = ‘Best Interview Questions’;
$blog->save()
// Now you can use (after save() function we can use like this)
$blog->id // It will display last inserted id

In case you are using insertGetId()

$insertGetId = DB::table(‘blogs’)->insertGetId([‘title’ => ‘Best Interview Questions’]);

BY Best Interview Question ON 02 Mar 2023