You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
432 B

5 years ago
5 years ago
5 years ago
5 years ago
  1. <?php
  2. namespace App\Model\v3;
  3. use App\Model\Model;
  4. class CouponRec extends Model
  5. {
  6. protected $table = 'lanzu_coupon_receive';
  7. protected $appends = [
  8. 'used_num'
  9. ];
  10. public function getUsedNumAttribute()
  11. {
  12. return ($this->attributes['number'] - $this->attributes['number_remain']);
  13. }
  14. public function coupon()
  15. {
  16. return $this->hasOne(Coupon::class,'id','coupon_id');
  17. }
  18. }