InviteNewUsersGiveGiftLog.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. *
  4. *
  5. * @category xxx
  6. * @package PSR
  7. * @subpackage Documentation\API
  8. * @author xxx <xxx@xxx.com>
  9. * @license GPL https://xxx.com
  10. * @link https://xxx.com
  11. * @ctime: 2020/4/15 14:24
  12. */
  13. namespace App\Models;
  14. use App\Traits\ModelHelpers;
  15. class InviteNewUsersGiveGiftLog extends Model
  16. {
  17. use ModelHelpers;
  18. protected $table = 'invite_new_users_give_gift_logs';
  19. protected $fillable = ['user_id','invite_new_users_configs_id','gift_type','gift_id','gift_num','merchant_id'];
  20. const GIFT_TYPE_CARD = 'card';
  21. const GIFT_TYPE_COUPON = 'coupon';
  22. const GIFT_TYPE_BALANCE = 'balance';
  23. public static $giftTypeMaps = [
  24. self::GIFT_TYPE_CARD => '骑行卡',
  25. self::GIFT_TYPE_COUPON => '优惠券',
  26. self::GIFT_TYPE_BALANCE => '余额',
  27. ];
  28. public function inviteNewUsersConfig(){
  29. return $this->belongsTo(InviteNewUsersConfig::class,'invite_new_users_configs_id','id');
  30. }
  31. // public function gift(){
  32. // return $this->morphTo();
  33. // }
  34. public function users(){
  35. return $this->belongsTo(User::class,'user_id','id');
  36. }
  37. }