39 lines
785 B
PHP
39 lines
785 B
PHP
<?php
|
|
|
|
/**
|
|
* 数据模型基类
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Dhd\Micro\Core;
|
|
|
|
use Hyperf\DbConnection\Model\Model as HyperfModel;
|
|
use Hyperf\ModelCache\Cacheable;
|
|
use Hyperf\ModelCache\CacheableInterface;
|
|
|
|
abstract class Model extends HyperfModel implements CacheableInterface
|
|
{
|
|
use Cacheable;
|
|
|
|
/**
|
|
* 时间戳格式.
|
|
*/
|
|
protected ?string $dateFormat = 'Y-m-d H:i:s';
|
|
|
|
/**
|
|
* 隐藏字段.
|
|
*/
|
|
protected array $hidden = [
|
|
'deleted_at',
|
|
];
|
|
|
|
/**
|
|
* 排序配置:
|
|
* - false: 禁用排序
|
|
* - 字符串: 排序字段(默认升序)
|
|
* - 数组: ['field' => '字段名', 'direction' => 'asc/desc'].
|
|
*/
|
|
protected array|bool|string $sortable = false; // 'sort'; // 默认按sort字段升序
|
|
}
|