How to get the last insert id in laravel query builder.

  • Neel Bhardwaj

  • 07-Feb-2022


  • 106

$id = DB::table('table-name')->insertGetId(
    ['name' => 'abc', 'email' => '']

"Programming isn't about what you know,
it's about what you can figure out.”
Chris Pine

Neel Bhardwaj

A full stack developer. I have a Passion for Creating Clean, Beautiful, Interactive, Minimalistic, Responsive and User Friendly website, Developed by Modular, Scalable and Functional Code.

Recent comments

Leave a reply