HotelOrderModel.php 903 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace app\common\model;
  3. use think\Db;
  4. use think\Model;
  5. /**
  6. * 群组
  7. */
  8. class HotelOrderModel extends Model
  9. {
  10. // 表名
  11. protected $name = 'hotel_order';
  12. // 开启自动写入时间戳字段
  13. protected $autoWriteTimestamp = false;
  14. // 定义时间戳字段名
  15. protected $createTime = false;
  16. protected $updateTime = false;
  17. protected $deleteTime = false;
  18. public function getImageAttr($value, $data)
  19. {
  20. return cdnurl($value);
  21. }
  22. public function getImagesAttr($value, $data)
  23. {
  24. $value = explode(',',$value);
  25. foreach ($value as &$v){
  26. $v = cdnurl($v);
  27. }
  28. return $value;
  29. }
  30. public function hotel()
  31. {
  32. return $this->hasOne(HotelModel::class, 'id', 'hotel_id');
  33. }
  34. public function room()
  35. {
  36. return $this->hasOne(HotelRoomModel::class, 'id', 'room_id');
  37. }
  38. }