mirror of
https://github.com/flarum/framework.git
synced 2025-01-22 12:54:59 +08:00
parent
23709a77a2
commit
5dbe97630c
|
@ -28,15 +28,25 @@ class FulltextGambit implements GambitInterface
|
||||||
$this->users = $users;
|
$this->users = $users;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $searchValue
|
||||||
|
* @return \Illuminate\Database\Eloquent\Builder
|
||||||
|
*/
|
||||||
|
private function getUserSearchSubQuery($searchValue)
|
||||||
|
{
|
||||||
|
return $this->users
|
||||||
|
->query()
|
||||||
|
->select('id')
|
||||||
|
->where('username', 'like', "{$searchValue}%");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function apply(AbstractSearch $search, $bit)
|
public function apply(AbstractSearch $search, $searchValue)
|
||||||
{
|
{
|
||||||
$users = $this->users->getIdsForUsername($bit, $search->getActor());
|
$search->getQuery()
|
||||||
|
->whereIn('id',
|
||||||
$search->getQuery()->whereIn('id', $users);
|
$this->getUserSearchSubQuery($searchValue));
|
||||||
|
|
||||||
$search->setDefaultSort(['id' => $users]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user