From e09a393dc3696e8a0793058a4bc5a5245652ae0a Mon Sep 17 00:00:00 2001 From: Forms Dev Date: Tue, 17 Oct 2023 09:20:55 +0530 Subject: [PATCH] URL input validation rule --- app/Http/Requests/AnswerFormRequest.php | 3 ++- app/Rules/ValidUrl.php | 33 +++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 app/Rules/ValidUrl.php diff --git a/app/Http/Requests/AnswerFormRequest.php b/app/Http/Requests/AnswerFormRequest.php index 503e7b5b5..be8085072 100644 --- a/app/Http/Requests/AnswerFormRequest.php +++ b/app/Http/Requests/AnswerFormRequest.php @@ -12,6 +12,7 @@ use Illuminate\Http\Request; use App\Rules\ValidHCaptcha; use App\Rules\ValidPhoneInputRule; +use App\Rules\ValidUrl; class AnswerFormRequest extends FormRequest { @@ -171,7 +172,7 @@ private function getPropertyRules($property): array $this->requestRules[$property['id'].'.*'] = [new StorageFile($this->maxFileSize, [], $this->form)]; return ['array']; } - return ['url']; + return [new ValidUrl]; case 'files': $allowedFileTypes = []; if(!empty($property['allowed_file_types'])){ diff --git a/app/Rules/ValidUrl.php b/app/Rules/ValidUrl.php new file mode 100644 index 000000000..cc694ec59 --- /dev/null +++ b/app/Rules/ValidUrl.php @@ -0,0 +1,33 @@ +