GoodsService.php 756 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace app\common\models\goods;
  3. use app\common\models\BaseModel;
  4. /**
  5. * Author: 芸众商城 www.yunzshop.com
  6. * Date: 2018/5/22
  7. */
  8. class GoodsService extends BaseModel
  9. {
  10. public $table = 'yz_goods_service';
  11. public $attributes = [
  12. 'is_refund' => 1,
  13. 'is_automatic' => 0,
  14. 'serviceFee' => 0,
  15. ];
  16. public $timestamps = false;
  17. protected $guarded = [];
  18. public function scopeOfGoodsId($query, $goodsId)
  19. {
  20. return $query->where('goods_id', $goodsId);
  21. }
  22. /**
  23. * 初始化方法
  24. */
  25. public static function boot()
  26. {
  27. parent::boot();
  28. // 添加了公众号id的全局条件.
  29. static::addGlobalScope(function ($builder) {
  30. $builder->uniacid();
  31. });
  32. }
  33. }