Gift.php 594 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace app\common\model\plus\live;
  3. use app\common\model\BaseModel;
  4. /**
  5. * 礼物模型
  6. */
  7. class Gift extends BaseModel
  8. {
  9. protected $name = 'live_gift';
  10. protected $pk = 'gift_id';
  11. /**
  12. * 关联封面图
  13. */
  14. public function image()
  15. {
  16. return $this->hasOne('app\\common\\model\\file\\UploadFile', 'file_id', 'image_id')
  17. ->bind(['file_path', 'file_name', 'file_url']);
  18. }
  19. /**
  20. * 详情
  21. */
  22. public static function detail($gift_id, $with = [])
  23. {
  24. return (new static())->with($with)->find($gift_id);
  25. }
  26. }