📌  相关文章
📜  laravel eloquent 获得 3 个月 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:56.503000             🧑  作者: Mango

代码示例1
$dateS = Carbon::now()->startOfMonth()->subMonth(3);
$dateE = Carbon::now()->startOfMonth(); 
$TotalSpent = DB::table('orders')
->select('total_cost','placed_at')
->whereBetween('placed_at',[$dateS,$dateE])
->where(['deleted' => '0', 'delivery_address_id' => $DeliveryAddress->id])
->sum('total_cost');