内核更新

This commit is contained in:
2016-08-23 18:01:41 +08:00
parent 707ebdf51d
commit 94582d442c
22 changed files with 249 additions and 286 deletions

View File

@@ -37,7 +37,7 @@ trait SoftDelete
public static function onlyTrashed()
{
$model = new static();
return $model->db()->where(static::$deleteTime, '>', 0);
return $model->db()->where(static::$deleteTime, 'exp', 'is not null');
}
/**
@@ -104,7 +104,9 @@ trait SoftDelete
{
if (static::$deleteTime) {
// 恢复删除
$this->setAttr(static::$deleteTime, 0);
$name = static::$deleteTime;
$this->change[] = $name;
$this->data[$name] = null;
return $this->isUpdate()->save();
}
return false;
@@ -118,7 +120,7 @@ trait SoftDelete
protected static function base($query)
{
if (static::$deleteTime) {
$query->where(static::$deleteTime, 0);
$query->where(static::$deleteTime, 'null');
}
}