diff --git a/Web/Models/Repositories/Users.php b/Web/Models/Repositories/Users.php index 33d503f6..82434a18 100644 --- a/Web/Models/Repositories/Users.php +++ b/Web/Models/Repositories/Users.php @@ -38,16 +38,16 @@ class Users function find(string $query, int $page = 1, ?int $perPage = NULL): \Traversable { - $query = "$query%"; + $query = "%$query%"; $perPage = $perPage ?? OPENVK_DEFAULT_PER_PAGE; - foreach($this->users->where("first_name LIKE ? OR last_name LIKE ?", $query,$query)->page($page, $perPage) as $result) + foreach($this->users->where("CONCAT_WS(' ', first_name, last_name) LIKE ?", $query)->page($page, $perPage) as $result) yield new User($result); } function getFoundCount(string $query): int { - $query = "$query%"; - return sizeof($this->users->where("first_name LIKE ? OR last_name LIKE ?", $query, $query)); + $query = "%$query%"; + return sizeof($this->users->where("CONCAT_WS(' ', first_name, last_name) LIKE ?", $query)); } function getStatistics(): object diff --git a/Web/Presenters/templates/@layout.xml b/Web/Presenters/templates/@layout.xml index a7ddbd3f..3003019d 100644 --- a/Web/Presenters/templates/@layout.xml +++ b/Web/Presenters/templates/@layout.xml @@ -69,7 +69,7 @@ {_"header_log_out"}