GoodsLimitPurchaseRuleModel.php 698 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. declare(strict_types=1);
  3. namespace SixShop\LimitPurchase\Model;
  4. use think\Model;
  5. use think\model\concern\SoftDelete;
  6. use think\model\relation\BelongsTo;
  7. /**
  8. * 商品限购规则关联模型
  9. *
  10. * @property int $id 主键
  11. * @property int $goods_id 商品ID
  12. * @property int $rule_id 限购规则ID
  13. */
  14. class GoodsLimitPurchaseRuleModel extends Model
  15. {
  16. /**
  17. * 获取模型选项
  18. *
  19. * @return array
  20. */
  21. protected function getOptions(): array
  22. {
  23. return [
  24. 'name' => 'goods_limit_purchase_rule',
  25. ];
  26. }
  27. public function rule():BelongsTo
  28. {
  29. return $this->belongsTo(LimitPurchaseRuleModel::class, 'rule_id', 'id');
  30. }
  31. }