From 81417b6e24bf372d7057945bd2d9b10b24e99479 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 11 Jan 2021 19:15:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Database/Traits/QueryTrait.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Database/Traits/QueryTrait.php b/Database/Traits/QueryTrait.php index d5b03a4d..a39ad630 100644 --- a/Database/Traits/QueryTrait.php +++ b/Database/Traits/QueryTrait.php @@ -76,6 +76,18 @@ trait QueryTrait } + /** + * @param string $column + * @param string $value + * @return $this + */ + public function locate(string $column, string $value): static + { + $this->where[] = 'LOCATE(' . $column . ',\'' . addslashes($value) . '\')'; + return $this; + } + + /** * @param $column * @return $this