This commit is contained in:
Aether
2025-09-18 10:46:54 +08:00
commit 0920cef866
62 changed files with 13547 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
<?php
namespace Aether\Traits;
use Hyperf\Database\Model\SoftDeletes;
/**
* 通用软删除Trait供需要软删除的模型使用
*/
trait AetherSoftDelete
{
use SoftDeletes;
/**
* 初始化软删除相关配置自动隐藏deleted_at字段
*/
protected function initializeAetherSoftDeletes(): void
{
// 自动将deleted_at添加到隐藏字段避免序列化时暴露
if (!in_array('deleted_at', $this->hidden, true)) {
$this->hidden[] = 'deleted_at';
}
}
}