i am using this query to get 2 different results in $week_expence
and $month_expence
$week = \Carbon\Carbon::today()->subDays(7);
$month = \Carbon\Carbon::today()->subDays(30);
$expences = SellerSell::where(['seller_id' => $id , 'order_confirmed_by' => $id ]);
$week_expence = $expences->where('created_at','>=',$week)->sum('expenses');
$month_expence = $expences->where('created_at','>=',$month)->sum('expenses');
dd($week_expence , $month_expence);
consider if $week_expence
= 10 and $month_expence
= 20 then i get result in both veriables week and month is 10 why i am getting week expence in month?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire