I am trying to take an authenticated user in a request, and update the many-to-many pivot table between a User and Project. I can do this with static data, but now I want to use
increment() to do this atomically.
An example of my static code:
request() ->user() ->projects() ->updateExistingPivot($project->id, [ 'spent' => '123456789', 'paid' => '987654321' ]);
How would I go about incorporating
increment() into this query? I am still new and am not sure when to reach for the query builder, vs uncovering an Eloquent method.