'后台管理员赠送', self::TYPE_INVITE_NEW_GIVE => '邀请新用户赠送', ]; const STATUS_OK = 1; const STATUS_NO = 0; const STATUS_USED = 2; public static $statusMaps = [ self::STATUS_OK=>'启用', self::STATUS_NO=>'停用', self::STATUS_USED=>'已使用', ]; const VALID_TYPE_ABSOLUTELY = 1; const VALID_TYPE_RELATIVE = 2; public static $validTypeMaps = [ self::VALID_TYPE_ABSOLUTELY => '绝对时效', self::VALID_TYPE_RELATIVE => '相对时效', ]; const ORDER_TYPE_NORMAL = 1; const ORDER_TYPE_RENT = 2; const ORDER_TYPE_ALL = 3; public static $orderTypeMaps = [ self::ORDER_TYPE_NORMAL => '仅普通订单可用', self::ORDER_TYPE_RENT => '仅日租订单可用', self::ORDER_TYPE_ALL => '所有订单可用', ]; public function getCouponsDataAttribute($value) { return json_decode($value,true); } public function setCouponsDataAttribute($value) { $this->attributes['coupons_data'] = json_encode($value); } public function users(){ return $this->belongsTo(User::class,'user_id','id'); } public function coupons(){ return $this->belongsTo(Coupon::class,'coupon_id','id'); } }