fix: normalize order timestamps to start of day and prevent future-dated entries in OrderSeeder

This commit is contained in:
Yoga Pangestu 2026-04-24 13:26:21 +07:00
parent bfef057e6f
commit 0ede7280a4

View File

@ -62,7 +62,11 @@ public function run(): void
$customer = $customers->random(); $customer = $customers->random();
$status = $this->getRandomStatus(); $status = $this->getRandomStatus();
$orderedAt = $date->copy()->addHours(rand(8, 22))->addMinutes(rand(0, 59)); $orderedAt = $date->copy()->startOfDay()->addHours(rand(8, 22))->addMinutes(rand(0, 59));
if ($orderedAt->gt(now())) {
$orderedAt = now();
}
$order = Order::create([ $order = Order::create([
'outlet_id' => $outlet->id, 'outlet_id' => $outlet->id,