delete:transtrait
This commit is contained in:
parent
48c41f7948
commit
566514f729
@ -18,7 +18,7 @@ use catcher\traits\db\ScopeTrait;
|
|||||||
*/
|
*/
|
||||||
abstract class CatchModel extends \think\Model
|
abstract class CatchModel extends \think\Model
|
||||||
{
|
{
|
||||||
use SoftDelete, TransTrait, BaseOptionsTrait, ScopeTrait, RewriteTrait;
|
use SoftDelete, BaseOptionsTrait, ScopeTrait, RewriteTrait;
|
||||||
|
|
||||||
protected $createTime = 'created_at';
|
protected $createTime = 'created_at';
|
||||||
|
|
||||||
|
@ -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());
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user