@@ -20,6 +20,14 @@ class OpportunityContacts
|
||||
$record = Opportunity::withTrashed()->findOrFail($id);
|
||||
$access->authorize($actor, 'edit', $record);
|
||||
abort_unless($access->mfa($actor), 403, 'Confirme a autenticação multifator nesta sessão.');
|
||||
// Validate the persisted form of names/email, rather than padding.
|
||||
// Non-string input stays with the validator and cannot cause a TypeError.
|
||||
if (is_string($input['full_name'] ?? null)) {
|
||||
$input['full_name'] = trim(preg_replace('/\s+/u', ' ', $input['full_name']));
|
||||
}
|
||||
if (is_string($input['email'] ?? null)) {
|
||||
$input['email'] = strtolower(trim($input['email']));
|
||||
}
|
||||
$data = Validator::make($input, [
|
||||
'etag' => 'required|string|size:64',
|
||||
'full_name' => 'required|string|min:2|max:150',
|
||||
@@ -28,8 +36,6 @@ class OpportunityContacts
|
||||
'investor_id' => 'nullable|uuid',
|
||||
'investor_type' => ['nullable', Rule::in(['domestic', 'foreign', 'institutional', 'individual'])],
|
||||
])->validate();
|
||||
$data['email'] = strtolower(trim($data['email']));
|
||||
$data['full_name'] = trim(preg_replace('/\s+/u', ' ', $data['full_name']));
|
||||
|
||||
return DB::transaction(function () use ($actor, $id, $data, $access) {
|
||||
$record = Opportunity::withTrashed()->whereKey($id)->lockForUpdate()->firstOrFail();
|
||||
|
||||
Reference in New Issue
Block a user