diff --git a/src/Traits/ValidatesEncrypted.php b/src/Traits/ValidatesEncrypted.php index a207003..5055dce 100644 --- a/src/Traits/ValidatesEncrypted.php +++ b/src/Traits/ValidatesEncrypted.php @@ -27,7 +27,7 @@ public function addValidators() $field = isset($parameters[1]) ? $parameters[1] : $attribute; $ignore = isset($parameters[2]) ? $parameters[2] : null; - $items = DB::select("SELECT count(*) as aggregate FROM `" . $parameters[0] . "` WHERE AES_DECRYPT(`" . $field . "`, '" . config("app.key") . "') LIKE '" . $value . "' COLLATE utf8mb4_general_ci" . ($ignore ? " AND id != " . $ignore : '')); + $items = DB::select("SELECT count(*) as aggregate FROM `" . $parameters[0] . "` WHERE AES_DECRYPT(`" . $field . "`, '" . config("mysql-encrypt.key") . "') LIKE '" . $value . "' COLLATE utf8mb4_general_ci" . ($ignore ? " AND id != " . $ignore : '')); return $items[0]->aggregate == 0; }); @@ -40,7 +40,7 @@ public function addValidators() $field = isset($parameters[1]) ? $parameters[1] : $attribute; - $items = DB::select("SELECT count(*) as aggregate FROM `" . $parameters[0] . "` WHERE AES_DECRYPT(`" . $field . "`, '" . config("app.key") . "') LIKE '" . $value . "' COLLATE utf8mb4_general_ci"); + $items = DB::select("SELECT count(*) as aggregate FROM `" . $parameters[0] . "` WHERE AES_DECRYPT(`" . $field . "`, '" . config("mysql-encrypt.key") . "') LIKE '" . $value . "' COLLATE utf8mb4_general_ci"); return $items[0]->aggregate > 0; });