Skip to content

Commit ccb59ea

Browse files
chore
1 parent 2740499 commit ccb59ea

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

src/Query/FrontFilter.php

+9-17
Original file line numberDiff line numberDiff line change
@@ -11,36 +11,28 @@
1111

1212
namespace FoF\FrontPage\Query;
1313

14-
use Flarum\Search\AbstractQueryState;
14+
use Flarum\Search\Database\DatabaseSearchState;
1515
use Flarum\Search\Filter\FilterInterface;
1616
use Flarum\Search\SearchState;
17+
use Illuminate\Database\Eloquent\Builder;
1718

19+
/**
20+
* @implements FilterInterface<DatabaseSearchState>
21+
*/
1822
class FrontFilter implements FilterInterface
1923
{
20-
/**
21-
* @return string
22-
*/
23-
24-
/**
25-
* @return string
26-
*/
2724
public function getFilterKey(): string
2825
{
2926
return 'frontpage';
3027
}
3128

32-
public function conditions(AbstractQueryState $search, array $matches, $negate)
33-
{
34-
$this->constrain($search->getQuery(), $negate);
35-
}
36-
37-
public function filter(SearchState $state, array|string $value, bool $negate): void
29+
public function filter(SearchState $state, string|array $value, bool $negate): void
3830
{
3931
$this->constrain($state->getQuery(), $negate);
4032
}
4133

42-
protected function constrain(\Illuminate\Database\Eloquent\Builder $query, bool $actor): void
34+
protected function constrain(Builder $query, bool $negate): void
4335
{
44-
$query->where('frontpage', !$actor);
36+
$query->where('frontpage', ! $negate);
4537
}
46-
}
38+
}

0 commit comments

Comments
 (0)