fix: normalize order timestamps to start of day and prevent future-dated entries in OrderSeeder
This commit is contained in:
parent
bfef057e6f
commit
0ede7280a4
@ -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,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user