ClientMessage.php 835 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace app\model;
  3. use DateTimeInterface;
  4. use support\Model;
  5. class ClientMessage extends Model
  6. {
  7. protected $table = 'client_message';
  8. protected $primaryKey = 'client_message_id';
  9. protected $dateFormat = 'U';
  10. const CREATED_AT = 'client_message_addtimes';
  11. 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 member()
  17. {
  18. return $this->hasOne(Member::class, 'member_id', 'join_client_message_recv_member_id')
  19. ->select('member_id', 'member_mobile');
  20. }
  21. public function cert()
  22. {
  23. return $this->hasOne(MemberCert::class, 'join_cert_member_id', 'join_client_message_recv_member_id')
  24. ->select('join_cert_member_id', 'member_cert_name');
  25. }
  26. }