MemberQuota.php 891 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace app\model;
  3. use DateTimeInterface;
  4. use support\Model;
  5. class MemberQuota extends Model
  6. {
  7. protected $table = 'member_quota';
  8. protected $primaryKey = 'member_quota_id';
  9. protected $keyType = 'string';
  10. protected $dateFormat = 'U';
  11. const CREATED_AT = 'member_quota_addtimes';
  12. const UPDATED_AT = null;
  13. protected function serializeDate(DateTimeInterface $date)
  14. {
  15. return $date->format('Y-m-d H:i:s');
  16. }
  17. public function member()
  18. {
  19. return $this->hasOne(Member::class, 'member_id', 'join_quota_member_id');
  20. }
  21. public function cert()
  22. {
  23. return $this->hasOne(MemberCert::class, 'join_cert_member_id', 'join_quota_member_id');
  24. }
  25. public function component()
  26. {
  27. return $this->hasOne(RuleAddedComponent::class, 'rule_added_component_id', 'join_member_rule_added_component_id');
  28. }
  29. }