refactor: 修改自动写入时间的格式为在数据库配置文件配置
This commit is contained in:
@@ -16,8 +16,6 @@ class AttachmentCategoryModel extends AttachmentCategoryBaseModel
|
||||
use SoftDelete;
|
||||
// 软删除字段
|
||||
protected $deleteTime = 'deleted_at';
|
||||
// 自动写入时间格式
|
||||
protected $autoWriteTimestamp = 'datetime';
|
||||
|
||||
// 关联附件
|
||||
public function attachment()
|
||||
|
||||
@@ -16,8 +16,6 @@ class AttachmentModel extends AttachmentBaseModel
|
||||
use SoftDelete;
|
||||
// 软删除字段
|
||||
protected $deleteTime = 'deleted_at';
|
||||
// 自动写入时间格式
|
||||
protected $autoWriteTimestamp = 'datetime';
|
||||
|
||||
// JSON字段
|
||||
protected $json = ['attach'];
|
||||
|
||||
@@ -16,8 +16,6 @@ class ProductAttrModel extends ProductAttrBaseModel
|
||||
use SoftDelete;
|
||||
// 软删除字段
|
||||
protected $deleteTime = 'deleted_at';
|
||||
// 修改自动写入时间格式
|
||||
protected $autoWriteTimestamp = 'datetime';
|
||||
|
||||
// 关联属性特征
|
||||
public function props()
|
||||
|
||||
@@ -16,8 +16,6 @@ class ProductCategoryModel extends ProductCategoryBaseModel
|
||||
use SoftDelete;
|
||||
// 软件字段
|
||||
protected $deleteTime = 'deleted_at';
|
||||
// 修改自动写入时间格式
|
||||
protected $autoWriteTimestamp = 'datetime';
|
||||
|
||||
// 根据pid查询
|
||||
public function scopePid($query, $pid)
|
||||
|
||||
@@ -16,8 +16,6 @@ class ProductModel extends ProductBaseModel
|
||||
use SoftDelete;
|
||||
// 软件字段
|
||||
protected $deleteTime = 'deleted_at';
|
||||
// 修改自动写入时间格式
|
||||
protected $autoWriteTimestamp = 'datetime';
|
||||
|
||||
// 分类关联查询
|
||||
public function category()
|
||||
|
||||
@@ -16,8 +16,6 @@ class SysUserModel extends SysUserBaseModel
|
||||
use SoftDelete;
|
||||
// 软件删除字段
|
||||
protected $deleteTime = 'deleted_at';
|
||||
// 自动写入时间格式
|
||||
protected $autoWriteTimestamp = 'datetime';
|
||||
|
||||
// 隐藏字段
|
||||
protected $hidden = ['password', 'salt'];
|
||||
|
||||
@@ -16,8 +16,6 @@ class VideoCategoryModel extends VideoCategoryBaseModel
|
||||
use SoftDelete;
|
||||
// 软删除字段
|
||||
protected $deleteTime = 'deleted_at';
|
||||
// 自动写入时间格式
|
||||
protected $autoWriteTimestamp = 'datetime';
|
||||
|
||||
// 关联视频模型
|
||||
public function video()
|
||||
|
||||
@@ -16,8 +16,6 @@ class VideoModel extends VideoBaseModel
|
||||
use SoftDelete;
|
||||
// 软件删除字段
|
||||
protected $deleteTime = 'deleted_at';
|
||||
// 自动写入的时间格式
|
||||
protected $autoWriteTimestamp = 'datetime';
|
||||
|
||||
// 关联分类
|
||||
public function category()
|
||||
|
||||
@@ -10,13 +10,13 @@ return [
|
||||
// 自动写入时间戳字段
|
||||
// true为自动识别类型 false关闭
|
||||
// 字符串则明确指定时间字段类型 支持 int timestamp datetime date
|
||||
'auto_timestamp' => true,
|
||||
'auto_timestamp' => 'timestamp',
|
||||
|
||||
// 时间字段取出后的默认时间格式
|
||||
'datetime_format' => 'Y-m-d H:i:s',
|
||||
|
||||
// 时间字段配置 配置格式:create_time,update_time
|
||||
'datetime_field' => '',
|
||||
'datetime_field' => 'created_at,updated_at',
|
||||
|
||||
// 数据库连接配置信息
|
||||
'connections' => [
|
||||
|
||||
Reference in New Issue
Block a user