Skip to content

Commit

Permalink
支持时间字段配置
Browse files Browse the repository at this point in the history
  • Loading branch information
liu21st committed Jul 16, 2021
1 parent 7f8d4d1 commit e371405
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/think/service/ModelService.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ public function boot()
$model->setDateFormat($config->get('database.datetime_format', 'Y-m-d H:i:s'));
}

$timeField = $config->get('database.datetime_field');
if (!empty($timeField)) {
[$createTime, $updateTime] = explode(',', $timeField);
$model->setTimeField($createTime, $updateTime);
}

});
}
}

0 comments on commit e371405

Please sign in to comment.