laravel-royalty icon indicating copy to clipboard operation
laravel-royalty copied to clipboard

Does the package allow reduction of a user's point?

Open sdkcodes opened this issue 3 years ago • 2 comments

Hi, I'd like to know if I deduct from a user's point using this package. For example, say a user can exchange some of their points for some reward, I'd want to reduce their point tally by that figure. How can I achieve that using this package?

sdkcodes avatar Feb 23 '22 13:02 sdkcodes

@sdkcodes Maybe a more intuitive Class or method like

$substract = Redeem::create([
    'name' => 'Free Session with points',
    'key' => 'redeemed-lesson',
    'description' => 'Session purchased with points',
    'points' => 1000,
]);

But also is it possible doing it with creating a point with a negative number?

what do you think @miracuthbert

gogl92 avatar Dec 07 '23 04:12 gogl92

I agree with you @gogl92, you can create a point class with a negative value, then call it where needed.

By default the points table accepts both positive and negative values.

miracuthbert avatar Dec 07 '23 15:12 miracuthbert