TableMakeFields.php 573 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace app\admin\model;
  3. use think\Model;
  4. class TableMakeFields extends Model {
  5. // 表名
  6. protected $name = 'tablemake_fields';
  7. // 开启自动写入时间戳字段
  8. protected $autoWriteTimestamp = 'int';
  9. // 定义时间戳字段名
  10. protected $createTime = 'createtime';
  11. protected $updateTime = 'updatetime';
  12. protected static function _initialize() {
  13. parent::_initialize();
  14. }
  15. protected static function init()
  16. {
  17. self::afterInsert(function ($row) {
  18. $row->save(['weigh' => $row['id']]);
  19. });
  20. }
  21. }