title: How to get last inserted id in Laravel?
body: <p>Here is my code</p>
  <pre><code> $users = DB::table('users')-&gt;insert(array(
       'email_id' =&gt; $email_id,
       'name' =&gt; $name,
   ));
  
   $lastInsertedID = $users-&gt;lastInsertId();
             
   return $lastInsertedID;
  </code></pre>
  <p>I want to get last inserted id for particular record. I have tried using Eloquent ORM. but it didn't work.</p>
  <p>Any help would be grateful.</p>
  <p>Thank You.</p>