Customer.php 443 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace app\model;
  3. use DateTimeInterface;
  4. use support\Model;
  5. class Customer extends Model
  6. {
  7. protected $table = 'customer';
  8. protected $dateFormat = 'U';
  9. public function serializeDate(DateTimeInterface $date)
  10. {
  11. return $date->format('Y-m-d H:i:s');
  12. }
  13. public function user()
  14. {
  15. return $this->hasOne(SysUser::class, 'user_id', 'creator')
  16. ->select('user_id', 'user_name');
  17. }
  18. }