I Have this code that increments an already existing record
$credit = Credit::where('user_id', Auth::getUser()->id)->first(); $credit->increment('amount', 600); $credit->fresh()->amount;
If the record does not already exist it throws up this error
"Call to a member function increment() on null"
How do i create the record if it does not already exist but if it exists, update it