最近剛接觸webman,感覺還不錯,但是就是不知道如何使用事務(wù),文檔也沒寫,希望盡快回復(fù)我,感謝!
原來是這樣
Db::connection()->beginTransaction();
try{
Db::table('xxx')->xxxx;
Db::table('xxx')->xxxx;
Db::connection()->commit();//提交至數(shù)據(jù)庫
}catch(\Exception $exception){
Db::connection()->rollback();//數(shù)據(jù)庫回滾
}