Files
fotospiel-app/app/Http/Requests/Checkout/CheckoutRegisterRequest.php
Codex Agent 33af04db1b
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled
Checkout: minimize registration data
2026-01-06 09:23:01 +01:00

60 lines
1.9 KiB
PHP

<?php
namespace App\Http\Requests\Checkout;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
use Illuminate\Validation\Rules\Password;
class CheckoutRegisterRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'email' => [
'required',
'email',
'max:255',
Rule::unique('users', 'email'),
Rule::unique('users', 'username'),
],
'password' => ['required', 'confirmed', Password::defaults()],
'first_name' => ['required', 'string', 'max:255'],
'last_name' => ['required', 'string', 'max:255'],
'address' => ['nullable', 'string', 'max:500'],
'phone' => ['nullable', 'string', 'max:255'],
'package_id' => ['required', 'exists:packages,id'],
'terms' => ['required', 'accepted'],
'privacy_consent' => ['required', 'accepted'],
'locale' => ['nullable', 'string', 'max:10'],
];
}
/**
* Get custom validation messages.
*/
public function messages(): array
{
return [
'email.unique' => 'Diese E-Mail-Adresse wird bereits verwendet.',
'password.confirmed' => 'Die Passwortbestätigung stimmt nicht überein.',
'package_id.exists' => 'Das ausgewählte Paket ist ungültig.',
'terms.accepted' => 'Bitte akzeptiere die Nutzungsbedingungen.',
'privacy_consent.accepted' => 'Bitte akzeptiere die Datenschutzerklärung.',
];
}
}