delete:transtrait

This commit is contained in:
JaguarJack 2021-04-24 20:31:19 +08:00
parent 48c41f7948
commit 566514f729
2 changed files with 1 additions and 51 deletions

View File

@ -18,7 +18,7 @@ use catcher\traits\db\ScopeTrait;
*/
abstract class CatchModel extends \think\Model
{
use SoftDelete, TransTrait, BaseOptionsTrait, ScopeTrait, RewriteTrait;
use SoftDelete, BaseOptionsTrait, ScopeTrait, RewriteTrait;
protected $createTime = 'created_at';

View File

@ -1,50 +0,0 @@
<?php
declare(strict_types=1);
namespace catcher\traits\db;
use think\facade\Db;
trait TransTrait
{
/**
*
* @time 2019年12月03日
* @return void
*/
public function startTrans()
{
Db::startTrans();
}
/**
*
* @time 2019年12月03日
* @return void
*/
public function commit()
{
Db::commit();
}
/**
*
* @time 2019年12月03日
* @return void
*/
public function rollback()
{
Db::rollback();
}
/**
*
* @time 2019年12月03日
* @param \Closure $function
* @return void
*/
public function transaction(\Closure $function)
{
Db::transaction($function());
}
}