<?php//頭部引入DB類use Illuminate\Support\Facades\DB;//在方法中獲取获取上一条insert语句产生的id$id = DB::getPdo()->lastInsertId();