File manager - Edit - /var/www/html/homologBancodetalentos/app/Http/Requests/TalentBank/CandidateRequest.php
Back
<?php namespace App\Http\Requests\TalentBank; use Illuminate\Foundation\Http\FormRequest; class CandidateRequest extends FormRequest { public function authorize(): bool { return true; } public function rules(): array { $rules = [ 'cpf' => 'required|string', 'name' => 'string', 'address' => 'string', 'zip_code' => 'string', 'birth_date' => 'date', 'special_needs' => 'boolean', 'telephone' => 'nullable|string', 'cellphone' => 'nullable|string', 'min_payment' => 'decimal:2', 'desired_payment' => 'decimal:2', 'cv_summary' => 'string', 'has_experience' => 'boolean', 'active' => 'boolean', 'neighbourhood_id' => 'integer|exists:neighbourhoods,id', 'gender_id' => 'integer|exists:genders,id', 'marital_status_id' => 'integer|exists:marital_statuses,id', 'occupation_id' => 'integer|exists:occupations,id', 'ethnicity_id' => 'nullable|integer|exists:ethnicities,id', ]; if ($this->method() == 'PUT') { $rules['cpf'] = 'string'; } return $rules; } public static function validateCpf($cpf): bool { $cpf = preg_replace('/[^0-9]/is', '', $cpf); if (strlen($cpf) != 11) { return false; } if (preg_match('/(\d)\1{10}/', $cpf)) { return false; } for ($t = 9; $t < 11; $t++) { for ($d = 0, $c = 0; $c < $t; $c++) { $d += $cpf[$c] * (($t + 1) - $c); } $d = ((10 * $d) % 11) % 10; if ($cpf[$c] != $d) { return false; } } return true; } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings