novas funcionalidades dos formulario
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-10-02 11:13:37 +02:00
parent a6afb4e97a
commit 4f35313d06
104 changed files with 7653 additions and 178 deletions
@@ -2,10 +2,12 @@
namespace App\Http\Requests;
use App\Services\ExistingBusinessDrafts;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
use Illuminate\Validation\Rule;
use Illuminate\Validation\Validator;
class StoreInterestRequestRequest extends FormRequest
{
@@ -36,12 +38,28 @@ class StoreInterestRequestRequest extends FormRequest
->where('status', 'published')->whereNotNull('published_at')
->where('published_at', '<=', now())->whereNull('deleted_at')),
])],
'existingBusinessId' => ['nullable', 'uuid', ...($knownKey ? [] : [
Rule::exists('existing_businesses', 'id')->where(fn ($query) => $query
->where('status', 'published')->whereNotNull('published_at')->where('published_at', '<=', now())->whereNull('deleted_at')),
])],
'modality' => ['nullable', 'required_with:existingBusinessId', 'string', 'max:50', Rule::in(ExistingBusinessDrafts::MODALITIES)],
'investmentRange' => ['nullable', 'string', 'max:80'],
'message' => ['required', 'string', 'min:20', 'max:2000'],
'privacyConsent' => ['required', 'accepted'],
'shareWithProponent' => ['sometimes', 'boolean'],
];
}
/** @return list<callable(Validator): void> */
public function after(): array
{
return [function (Validator $validator): void {
if ($this->filled('existingBusinessId') && $this->filled('opportunityReference')) {
$validator->errors()->add('existingBusinessId', 'Seleccione apenas uma oportunidade.');
}
}];
}
public function messages(): array
{
return [