update
This commit is contained in:
38
src/Model.php
Normal file
38
src/Model.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?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字段升序
|
||||
}
|
||||
Reference in New Issue
Block a user