whereNotNull('end_date') ->where('end_date', '<', $now) ->get(); if ($expiredPromotions->isEmpty()) { $this->info('No expired promotions found.'); return Command::SUCCESS; } $count = 0; foreach ($expiredPromotions as $promotion) { $promotion->update(['is_active' => false]); $this->line("Disabled promotion: {$promotion->name} (ended: {$promotion->end_date->format('Y-m-d')})"); $count++; } $this->info("Successfully disabled {$count} expired promotion(s)."); return Command::SUCCESS; } }