- Ö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>
40 lines
1.1 KiB
PHP
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]);
|
|
}
|
|
}
|