-1
Personal I have the following function within a Model Campaign.
public function success_payments(){
return $this->hasMany(Payment::class)->whereStatus('3');
}
This function returns the Payment table values that have status = 3.
Then I use a variable to return the values of this table by summing the values of the amount fields.
$raised = $this->success_payments()->sum('amount');
Until then everything was fine, I was meeting my needs, but now there was the need to recover another field of the Payment table called updated_at that a field of type date, and with this field do a logic where I can add to this field 14 days more, and return in the $Raised variable or create another variable, only the values where the value of the updated_at field summed 14 days is greater or equal to the current date.
I don’t know if my doubt is clear.
It is that previously I used a payment gatway, and now I am using a new payment gatway where the money is released only 14 days after payment confirmation, so I need to show the User only the amounts that have the status equal to 3, that is paid, and has the status change date summing 14 days.
Thanks for your help.