- Ö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>
44 lines
1.4 KiB
PHP
44 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Withdrawal;
|
|
|
|
use App\Models\OrderWithdrawal;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class WithdrawalStoreRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* @return array<string, array<int, mixed>>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'order_number' => ['required', 'string', 'max:50'],
|
|
'email' => ['required', 'email', 'max:255'],
|
|
'scope' => ['required', Rule::in([OrderWithdrawal::TYPE_FULL, OrderWithdrawal::TYPE_PARTIAL])],
|
|
'items' => ['array'],
|
|
'items.*' => ['integer', 'min:0'],
|
|
'reason' => ['nullable', 'string', 'max:2000'],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return array<string, string>
|
|
*/
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'order_number.required' => __('validation.required', ['attribute' => __('withdrawal.order_number')]),
|
|
'email.required' => __('validation.required', ['attribute' => __('withdrawal.email')]),
|
|
'email.email' => __('validation.email', ['attribute' => __('withdrawal.email')]),
|
|
'scope.required' => __('validation.required', ['attribute' => __('withdrawal.choose_scope_hl')]),
|
|
'scope.in' => __('validation.required', ['attribute' => __('withdrawal.choose_scope_hl')]),
|
|
];
|
|
}
|
|
}
|