jeudi 28 novembre 2019

how to retrieve the id just created in the database in laravel?

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

this my controller code

$cart= new cart;
        $cart->user_id = $request->user_id;
        $cart>vendor_name = $request->vendor_name;
$cart->save();

I want to retrieve the id of the data just created



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire