I'm trying to addDays to a date using Carbon with Laravel, but I don't get why I'm receiving this error. I have checked some posts in StackOverflow, but no one has helped me to solve it.
This is my code:
$user = Auth::user();
$orders = DB::table('orders')->where('user_id', Auth::user()->id)->get();
$totalValue = 0;
$percentage = 0;
$currentDate = $carbon->now();
$currentDate = Carbon::parse($currentDate)->format('d/m/Y');
//$percentage = ($order->price * 0.05) / 30;
foreach($orders as $order) {
$nextDate = Carbon::parse($order->created_at)->format('d/m/Y');
if(1 == 1) {
$nextDate->addDays(1);
DB::table('orders')->where('user_id', Auth::user()->id)->update(['profit' => $order->profit]);
}
The error:
via Chebli Mohamed

Aucun commentaire:
Enregistrer un commentaire