UniversityEventModel.php 818 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace app\common\model;
  3. use think\Db;
  4. use think\Model;
  5. /**
  6. * 群组
  7. */
  8. class UniversityEventModel extends Model
  9. {
  10. // 表名
  11. protected $name = 'university_event';
  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 apply()
  31. {
  32. return $this->hasOne(UniversityEventApplyModel::class, 'event_id', 'id');
  33. }
  34. }