startOfDay(); // Find all budgets that need daily reset $budgets = UserBudget::where('day_started_at', '<', $today) ->where('is_active', true) ->get(); $resetCount = 0; foreach ($budgets as $budget) { $budget->current_day_spending = 0.0; $budget->day_started_at = $today; $budget->save(); $resetCount++; } Log::info('Daily budgets reset', [ 'count' => $resetCount, 'date' => $today->toDateString() ]); } }