FormLog.php 809 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace app\common\model;
  3. use think\Model;
  4. class FormLog extends Model
  5. {
  6. // 设置字段信息
  7. protected $schema = [
  8. 'id' => 'int',
  9. 'userid' => 'int',
  10. 'formid' => 'int',
  11. 'remark' => 'string',
  12. 'createtime' => 'int'
  13. ];
  14. // 设置字段自动转换类型
  15. protected $type = [
  16. 'createtime' => 'timestamp:Y-m-d H:i'
  17. ];
  18. // 关联User
  19. public function user()
  20. {
  21. return $this->hasOne(User::class, "id", "userid");
  22. }
  23. // 关联Form
  24. public function form()
  25. {
  26. return $this->hasOne(Form::class, "id", "formid");
  27. }
  28. // 关联FormItem
  29. public function formItem()
  30. {
  31. return $this->hasMany(FormItem::class, "itemid", "id");
  32. }
  33. // 关联FormLogval
  34. public function formLogval()
  35. {
  36. return $this->hasMany(FormLogval::class, "logid", "id");
  37. }
  38. }