mirror of
https://github.com/flarum/framework.git
synced 2025-03-11 04:35:16 +08:00
parent
9ddd1b6e81
commit
2682c573eb
@ -30,15 +30,25 @@ class FulltextGambit implements GambitInterface
|
||||
$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}
|
||||
*/
|
||||
public function apply(AbstractSearch $search, $bit)
|
||||
public function apply(AbstractSearch $search, $searchValue)
|
||||
{
|
||||
$users = $this->users->getIdsForUsername($bit, $search->getActor());
|
||||
|
||||
$search->getQuery()->whereIn('id', $users);
|
||||
|
||||
$search->setDefaultSort(['id' => $users]);
|
||||
$search->getQuery()
|
||||
->whereIn('id',
|
||||
$this->getUserSearchSubQuery($searchValue));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user