mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 15:42:48 +08:00
软删除的删除字段默认值更改为null 兼容更多的时间字段类型
This commit is contained in:
@@ -104,7 +104,9 @@ trait SoftDelete
|
|||||||
{
|
{
|
||||||
if (static::$deleteTime) {
|
if (static::$deleteTime) {
|
||||||
// 恢复删除
|
// 恢复删除
|
||||||
$this->setAttr(static::$deleteTime, 0);
|
$name = static::$deleteTime;
|
||||||
|
$this->change[] = $name;
|
||||||
|
$this->data[$name] = ['exp', 'null'];
|
||||||
return $this->isUpdate()->save();
|
return $this->isUpdate()->save();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -118,7 +120,7 @@ trait SoftDelete
|
|||||||
protected static function base($query)
|
protected static function base($query)
|
||||||
{
|
{
|
||||||
if (static::$deleteTime) {
|
if (static::$deleteTime) {
|
||||||
$query->where(static::$deleteTime, 0);
|
$query->where(static::$deleteTime, 'exp', 'null');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user