There are several things suboptimal with your code, although its not directly visible why the described behaviour occurs.
$request->user
looks wrong. The user
form field isnt defined, and $request->user()
gives you the logged in user anyways, just as Auth::user()
. findOrFail
expects an id. Even if it works for created_by
I would clean this up.
Use unsigned integers or foreignId for ids and decimal for balance amounts.
If you say the correct donor_id lands in the request, it shouldnt be saved differently. Is this really true? You are accessing $member->user_id
- are members also users? Shouldnt it be $member->id
then? Can you dd
the whole $income
before saving it - what does it look like?
Do you have attribute casting on your model?