FarmPlot.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace app\model;
  3. use support\Model;
  4. class FarmPlot extends Model
  5. {
  6. protected $table = 'farm_plot';
  7. protected $primaryKey = 'farm_plot_id';
  8. protected $keyType = 'string';
  9. protected $dateFormat = 'U';
  10. public const CREATED_AT = 'farm_plot_addtimes';
  11. public const UPDATED_AT = null;
  12. public function serializeDate(\DateTimeInterface $date)
  13. {
  14. return $date->format('Y-m-d H:i:s');
  15. }
  16. public function dept()
  17. {
  18. return $this->hasOne(SysDept::class, 'dept_id', 'join_farm_plot_dept_id');
  19. }
  20. public function user()
  21. {
  22. return $this->hasOne(SysUser::class, 'user_id', 'join_farm_plot_user_id');
  23. }
  24. public function member()
  25. {
  26. return $this->hasOne(Member::class, 'member_id', 'join_farm_plot_member_id');
  27. }
  28. public function memberInfo()
  29. {
  30. return $this->hasOne(MemberInfo::class, 'join_info_member_id', 'join_farm_plot_member_id');
  31. }
  32. public function memberCert()
  33. {
  34. return $this->hasOne(MemberCert::class, 'join_cert_member_id', 'join_farm_plot_member_id');
  35. }
  36. }