From e5a7acbda7a586dd72fb866d6e013fc4e8172dda Mon Sep 17 00:00:00 2001 From: Brooke Bryan Date: Thu, 14 May 2020 16:21:14 +0100 Subject: [PATCH] Allow email validator message to be replaced --- src/Validators/EmailValidator.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Validators/EmailValidator.php b/src/Validators/EmailValidator.php index d449368..01b9c4a 100644 --- a/src/Validators/EmailValidator.php +++ b/src/Validators/EmailValidator.php @@ -3,11 +3,11 @@ class EmailValidator extends RegexValidator { - public function __construct() + public function __construct($message = 'Invalid email address') { parent::__construct( '/^[_a-zA-Z0-9+\-]+(\.[_a-zA-Z0-9+\-]+)*@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*(\.[a-zA-Z]{2,})$/', - 'invalid email address' + $message ); } }