GoodsCouponQueue.php 908 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * Author: 芸众商城 www.yunzshop.com
  4. * Date: 2017/7/13
  5. * Time: 下午3:10
  6. */
  7. namespace app\common\models;
  8. use app\common\models\BaseModel;
  9. use Illuminate\Database\Eloquent\SoftDeletes;
  10. class GoodsCouponQueue extends BaseModel
  11. {
  12. use SoftDeletes;
  13. public $table = 'yz_goods_coupon_queue';
  14. public static function getCouponQueue()
  15. {
  16. return self::uniacid()
  17. ->with('hasOneCoupon')
  18. ->with('hasOneMember')
  19. ->where('status',0);
  20. }
  21. public static function updatedData($condition, $updatedData)
  22. {
  23. return self::where($condition)
  24. ->update($updatedData);
  25. }
  26. public function hasOneCoupon()
  27. {
  28. return $this->hasOne('app\common\models\Coupon', 'id', 'coupon_id');
  29. }
  30. public function hasOneMember()
  31. {
  32. return $this->hasOne('app\common\models\Member', 'uid', 'uid');
  33. }
  34. }