how to retrieve the id just created in the database in laravel? : <p>how do I retrieve the id that was just created in the database, when I press the save button, the data is created, and I want to retrieve the id from that data</p>

<p>this my controller code</p>

<pre><code>$cart= new cart;
        $cart-&gt;user_id = $request-&gt;user_id;
        $cart&gt;vendor_name = $request-&gt;vendor_name;
$cart-&gt;save();
</code></pre>

<p>I want to retrieve the id of the data just created</p>
