I have this code:
if(Auth::user())
{
Auth::user()->points = $request->points + 100;
Auth::user()->save();
}
Everytime user hits submit button in comment box, he should get +100 points, the problem is when I hit submit, comment is saved and points is saved. For example if I had 0 points or more no matter how many, after every comment it's still keeps showing that I have 100. It seems that I can add another 100 to existing points, it just change the value it self and not adding more points.
$request->pointshas a value of0(or nothing at all, thus resulting innullwhich is equal to0if you're doing math), thus0+100=100...