46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class StoreUserLeadRequest 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, ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'email' => ['required', 'string', 'lowercase', 'email', 'max:255', 'unique:user_leads,email'],
|
|
'referrer_code' => ['nullable', 'string', 'max:12'],
|
|
'locale' => ['nullable', 'string', 'in:en,es,fr'],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get custom error messages for validation rules.
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'email.required' => 'Please enter your email address.',
|
|
'email.email' => 'Please enter a valid email address.',
|
|
'email.unique' => 'This email has already been registered.',
|
|
];
|
|
}
|
|
}
|