From 3edddbe8d096255c030977817aad3514546d4f4d Mon Sep 17 00:00:00 2001 From: yggverse Date: Sat, 3 Aug 2024 09:36:13 +0300 Subject: [PATCH] implement like method --- src/Model/Database/Auth.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/Model/Database/Auth.php b/src/Model/Database/Auth.php index f969683a..69df8b83 100644 --- a/src/Model/Database/Auth.php +++ b/src/Model/Database/Auth.php @@ -126,4 +126,30 @@ class Auth return $query->fetchAll(); } + + public function like( + string $request = '', + int $start = 0, + int $limit = 1000 + ): array + { + $query = $this->_connection->prepare( + sprintf( + 'SELECT * FROM `auth` + WHERE `request` LIKE :request + ORDER BY `request` ASC + LIMIT %d,%d', + $start, + $limit + ) + ); + + $query->execute( + [ + ':request' => $request + ] + ); + + return $query->fetchAll(); + } } \ No newline at end of file