Files
roxane/app/Http/Requests/Forms/MembershipRequest.php

49 lines
1.5 KiB
PHP
Raw Normal View History

2025-10-24 14:09:54 +02:00
<?php
namespace App\Http\Requests\Forms;
use App\Rules\ValidCaptcha;
2025-10-24 14:09:54 +02:00
use Illuminate\Foundation\Http\FormRequest;
class MembershipRequest extends FormRequest
{
public function authorize(): bool
{
2025-10-26 00:16:25 +02:00
return true;
2025-10-24 14:09:54 +02:00
}
/**
* @return array<string, string>
*/
public function messages(): array
{
return [
'phone1.digits' => 'Le numéro de téléphone doit contenir exactement 10 chiffres.',
'zipcode.digits' => 'Le code postal doit contenir exactement 5 chiffres.',
];
}
2025-10-24 14:09:54 +02:00
/**
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'member_type' => 'required|string|exists:member_types,identifier',
2025-10-24 14:09:54 +02:00
'lastname' => 'required|string|max:255',
'firstname' => 'required|string|max:255',
'email' => 'required|email|max:255',
'company' => 'nullable|string|max:255',
'desired_retzien_email' => ['nullable', 'string', 'max:64', 'regex:/^[a-z0-9._-]+$/'],
2025-10-24 14:09:54 +02:00
'address' => 'required|string|max:255',
'zipcode' => ['required', 'digits:5'],
2025-10-24 14:09:54 +02:00
'city' => 'required|string|max:255',
'phone1' => ['required', 'digits:10'],
2025-10-24 14:09:54 +02:00
'package' => 'required|string|max:255',
'amount' => 'required|numeric|min:0',
'cgu' => 'required|accepted',
'captcha' => ['required', new ValidCaptcha('captcha_membership')],
2025-10-24 14:09:54 +02:00
];
}
}