laravel 事务处理

public function Transaction(Request request,id)
{
  externalAccount=ExternalAccounts::find(id);
  DB::beginTransaction();

  try {

    externalAccount−>fundnumber=123456;
    externalAccount->capital_balance = 'jackie_chan';     $externalAccount->save();     DB::commit();   } catch (Exception $e){     DB::rollback();     throw $e;   } }

轉載:https://www.cnblogs.com/54sen/p/6814144.html

猜你喜欢

转载自www.cnblogs.com/clubs/p/9809008.html