mirror of
https://github.com/openvk/openvk
synced 2024-12-23 09:01:15 +03:00
Fix search
This commit is contained in:
parent
b7c914f35d
commit
6bf1c9bb29
2 changed files with 5 additions and 5 deletions
|
@ -38,16 +38,16 @@ class Users
|
||||||
|
|
||||||
function find(string $query, int $page = 1, ?int $perPage = NULL): \Traversable
|
function find(string $query, int $page = 1, ?int $perPage = NULL): \Traversable
|
||||||
{
|
{
|
||||||
$query = "$query%";
|
$query = "%$query%";
|
||||||
$perPage = $perPage ?? OPENVK_DEFAULT_PER_PAGE;
|
$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);
|
yield new User($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFoundCount(string $query): int
|
function getFoundCount(string $query): int
|
||||||
{
|
{
|
||||||
$query = "$query%";
|
$query = "%$query%";
|
||||||
return sizeof($this->users->where("first_name LIKE ? OR last_name LIKE ?", $query, $query));
|
return sizeof($this->users->where("CONCAT_WS(' ', first_name, last_name) LIKE ?", $query));
|
||||||
}
|
}
|
||||||
|
|
||||||
function getStatistics(): object
|
function getStatistics(): object
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
<a href="/logout">{_"header_log_out"}</a>
|
<a href="/logout">{_"header_log_out"}</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="link">
|
<div class="link">
|
||||||
<form action="search" method="get">
|
<form action="/search" method="get">
|
||||||
<input type="search" name="query" placeholder="{_"header_search"}" style="background: url('/assets/packages/static/openvk/img/search_icon.png') no-repeat 3px 4px; background-color: #fff; padding-left: 18px;width: 120px;" />
|
<input type="search" name="query" placeholder="{_"header_search"}" style="background: url('/assets/packages/static/openvk/img/search_icon.png') no-repeat 3px 4px; background-color: #fff; padding-left: 18px;width: 120px;" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue