From de3a1feba368abb1174ee12980e4641224f5659c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn?= Date: Mon, 21 Sep 2020 20:38:49 +0200 Subject: [PATCH] adding #45 --- app/Commands/LetsEncryptAddCommand.php | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/app/Commands/LetsEncryptAddCommand.php b/app/Commands/LetsEncryptAddCommand.php index ebb1750..fdf7492 100644 --- a/app/Commands/LetsEncryptAddCommand.php +++ b/app/Commands/LetsEncryptAddCommand.php @@ -3,9 +3,11 @@ namespace App\Commands; use Illuminate\Console\Scheduling\Schedule; -use Illuminate\Support\Facades\Validator; use LaravelZero\Framework\Commands\Command; +use Respect\Validation\Validator as v; +use Respect\Validation\Exceptions\NestedValidationException; + /** * Add LetsEncrypt Certificate * @@ -41,19 +43,8 @@ class LetsEncryptAddCommand extends Command { $email = $this->argument('email'); - // email for validator - $validator = Validator::make([ - 'email' => $email - ], [ - 'email' => ['email'], - ]); - - // show if error if first argument is not a email - if ($validator->fails()) { - foreach ($validator->errors()->all() as $error) { - $this->error($error); - } - + if (!v::email()->validate($email)) { + $this->error('First argument has to be a valid E-Mail! Failed!'); exit(); }