MemberRole.php 866 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace app\model;
  3. use DateTimeInterface;
  4. use support\Model;
  5. class MemberRole extends Model
  6. {
  7. protected $table = 'member_role';
  8. protected $primaryKey = 'member_role_id';
  9. protected $keyType = 'string';
  10. protected $dateFormat = 'U';
  11. const CREATED_AT = 'member_role_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 category()
  18. {
  19. return $this->hasOne(SysCategory::class, 'category_id', 'join_member_role_category_id')
  20. ->select('category_id', 'category_name');
  21. }
  22. public function rulePricing()
  23. {
  24. return $this->hasOne(RulePricing::class, 'rule_pricing_id', 'join_member_role_rule_pricing_id')
  25. ->select('rule_pricing_id', 'rule_pricing_name');
  26. }
  27. }