From fbd9a4bc01ff8f9995cd0f5cb00f92db5cd8669b Mon Sep 17 00:00:00 2001 From: Lloric Mayuga Garcia Date: Wed, 3 Mar 2021 09:11:24 +0800 Subject: [PATCH 1/4] Fix formatWheres in DatabaseRule --- src/Illuminate/Validation/Rules/DatabaseRule.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Validation/Rules/DatabaseRule.php b/src/Illuminate/Validation/Rules/DatabaseRule.php index b8113b2afadb..eec0a4a33d6f 100644 --- a/src/Illuminate/Validation/Rules/DatabaseRule.php +++ b/src/Illuminate/Validation/Rules/DatabaseRule.php @@ -195,8 +195,12 @@ public function queryCallbacks() */ protected function formatWheres() { - return collect($this->wheres)->map(function ($where) { - return $where['column'].','.'"'.str_replace('"', '""', $where['value']).'"'; + return collect($this->wheres)->map( function ($where) { + if (is_bool($where['value'])) { + return $where['column'].','.'true'; + } else { + return $where['column'].','.'"'.str_replace('"', '""', $where['value']).'"'; + } })->implode(','); } } From b3d007434914e04574004fa22b2c72bdaa6222bd Mon Sep 17 00:00:00 2001 From: Lloric Mayuga Garcia Date: Wed, 3 Mar 2021 09:22:59 +0800 Subject: [PATCH 2/4] Update DatabaseRule.php --- src/Illuminate/Validation/Rules/DatabaseRule.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Validation/Rules/DatabaseRule.php b/src/Illuminate/Validation/Rules/DatabaseRule.php index eec0a4a33d6f..ce630773b8ea 100644 --- a/src/Illuminate/Validation/Rules/DatabaseRule.php +++ b/src/Illuminate/Validation/Rules/DatabaseRule.php @@ -195,7 +195,7 @@ public function queryCallbacks() */ protected function formatWheres() { - return collect($this->wheres)->map( function ($where) { + return collect($this->wheres)->map(function ($where) { if (is_bool($where['value'])) { return $where['column'].','.'true'; } else { From 3feb11105eacc9966603f0588cb87714bbf8397e Mon Sep 17 00:00:00 2001 From: Lloric Mayuga Garcia Date: Wed, 3 Mar 2021 09:23:50 +0800 Subject: [PATCH 3/4] Update DatabaseRule.php --- src/Illuminate/Validation/Rules/DatabaseRule.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Validation/Rules/DatabaseRule.php b/src/Illuminate/Validation/Rules/DatabaseRule.php index ce630773b8ea..2cd70674d018 100644 --- a/src/Illuminate/Validation/Rules/DatabaseRule.php +++ b/src/Illuminate/Validation/Rules/DatabaseRule.php @@ -197,7 +197,7 @@ protected function formatWheres() { return collect($this->wheres)->map(function ($where) { if (is_bool($where['value'])) { - return $where['column'].','.'true'; + return $where['column'].','.($where['value']?'true':'false'); } else { return $where['column'].','.'"'.str_replace('"', '""', $where['value']).'"'; } From 78d8998aa5ef098bf978f2a7d41920756f6b792a Mon Sep 17 00:00:00 2001 From: Lloric Mayuga Garcia Date: Wed, 3 Mar 2021 09:34:57 +0800 Subject: [PATCH 4/4] Fix styleci --- src/Illuminate/Validation/Rules/DatabaseRule.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Validation/Rules/DatabaseRule.php b/src/Illuminate/Validation/Rules/DatabaseRule.php index 2cd70674d018..88b4d27cd941 100644 --- a/src/Illuminate/Validation/Rules/DatabaseRule.php +++ b/src/Illuminate/Validation/Rules/DatabaseRule.php @@ -197,7 +197,7 @@ protected function formatWheres() { return collect($this->wheres)->map(function ($where) { if (is_bool($where['value'])) { - return $where['column'].','.($where['value']?'true':'false'); + return $where['column'].','.($where['value'] ? 'true' : 'false'); } else { return $where['column'].','.'"'.str_replace('"', '""', $where['value']).'"'; }