I have a small fundraiser portion of my site and I need to keep adding to the total amount on every transaction and how many sponsors I get.
I have my transaction set as a POST request.
Route::post('/fundraiser/checkout', 'FundController@fundCheckout')->name('fundraiser-checkout');
In my controller I'm doing the following to increment the sponsors_received and funding_received.
Note the below $subscription->quantity = the amount given. $45 * 100 = 4500 cents for stripe.
$funds = DB::table('funds')->where('cin', $cin)
->increment('funding_received', $subscription->quantity)
->increment('sponsors_received');
Want to keep adding to funding_received total and sponsors_received.
This actually does add to my funding received, but fails on sponsors_received with an odd error.
Symfony\Component\Debug\Exception\FatalThrowableError Call to a member function increment() on integer
If I remove the funding_received query everything works fine. (Can I not use increment twice in a query?)
$funds = DB::table('funds')->where('cin', $cin)
->increment('sponsors_received');
Is there another way I can add to funding_received other than using increment?
Using Laravel 6+