mivita/database/factories/OrderWithdrawalFactory.php
Kevin 63c36555a5 Widerruf: Gesetzliche Online-Widerrufsfunktion (Formular, Bestätigungsmail, Admin-Verwaltung)
- Öffentliches Widerrufsformular /widerruf mit Bestell-Lookup (throttled)
- Bestätigungsmail an Kunde + Weiterleitung an bestellungen@ (config app.withdrawal_mail)
- Admin-Übersicht/-Detail unter /admin/withdrawals inkl. Sidenav-Eintrag
- Widerruf-Button in Portal-Bestellansicht und Footer-Links
- Model OrderWithdrawal + Migration + Factory + Tests

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-08 15:56:02 +00:00

40 lines
1.1 KiB
PHP

<?php
namespace Database\Factories;
use App\Models\OrderWithdrawal;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<OrderWithdrawal>
*/
class OrderWithdrawalFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'shopping_order_id' => null,
'user_shop_id' => null,
'type' => OrderWithdrawal::TYPE_FULL,
'status' => OrderWithdrawal::STATUS_RECEIVED,
'order_reference' => (string) $this->faker->numberBetween(1000, 99999),
'customer_email' => $this->faker->safeEmail(),
'customer_name' => $this->faker->name(),
'reason' => $this->faker->optional()->sentence(),
'items' => null,
'ip_address' => $this->faker->ipv4(),
'user_agent' => $this->faker->userAgent(),
'declared_at' => now(),
];
}
public function partial(): self
{
return $this->state(fn (): array => ['type' => OrderWithdrawal::TYPE_PARTIAL]);
}
}