EventNeeds.php 621 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace addons\qingdongams\model;
  3. use think\Model;
  4. use traits\model\SoftDelete;
  5. /**
  6. *
  7. */
  8. class EventNeeds Extends Model {
  9. // 开启自动写入时间戳字段
  10. protected $autoWriteTimestamp = 'int';
  11. // 定义时间戳字段名
  12. protected $createTime = 'createtime';
  13. protected $updateTime = 'updatetime';
  14. protected $name = 'qingdongams_event_needs';
  15. public function staff() {
  16. return $this->hasOne(Staff::class, 'id', 'create_staff_id')->field('id,name,num,img');
  17. }
  18. public function getCreatetimeAttr($value)
  19. {
  20. return date('Y-m-d H:i', $value);
  21. }
  22. }