49 lines
1.7 KiB
PHP
49 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Fo;
|
|
|
|
use App\Enums\DesiredLocation;
|
|
use App\Lib\Helpers\ToolboxHelper;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rules\Enum;
|
|
|
|
class JoinusRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
ToolboxHelper::validateRecaptcha($this, \config('services.google.recaptcha.version'));
|
|
|
|
return [
|
|
'last_name' => 'required|string|between:3,255',
|
|
'first_name' => 'required|string|between:3,255',
|
|
'email' => 'required|email:rfc,strict,dns,spoof,filter|max:255',
|
|
'phone' => 'required|numeric|min:0',
|
|
'desired_location' => ['required', new Enum(DesiredLocation::class)],
|
|
'message' => 'required|string|between:3,500',
|
|
"file" => "sometimes|nullable|mimes:pdf|max:10000"
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get custom attributes for validator errors.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function attributes(): array
|
|
{
|
|
return [
|
|
'first_name' => trans('validation.attributes.first_name'),
|
|
'last_name' => trans('validation.attributes.last_name'),
|
|
'email' => trans('validation.attributes.email'),
|
|
'phone' => trans('validation.attributes.phone'),
|
|
'desired_location' => trans('validation.custom.desired_location'),
|
|
'message' => trans('validation.attributes.message'),
|
|
'file' => trans('validation.attributes.file'),
|
|
];
|
|
}
|
|
}
|