How to get last inserted id through save() method in laravel

后端 未结 6 1765
醉酒成梦
醉酒成梦 2021-01-22 03:37

I know to get the last id I can use insertGetId() but I want to know how can I get the last inserted id through save() method.

order =          


        
6条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-22 03:56

    Try this once it worked for me where $mode->save(); was only returning true.

    $mylastid = DB::getPdo()->lastInsertId();
    

提交回复
热议问题