Skip to content

Commit

Permalink
Merge pull request #17 from niekappartmedia/main
Browse files Browse the repository at this point in the history
Added multiple site support for the search
  • Loading branch information
jonassiewertsen authored Jun 29, 2022
2 parents 166fb79 + ba9b5cc commit d982020
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Traits/SearchFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

use Illuminate\Support\Collection;
use Statamic\Facades\Search as StatamicSearchFacade;
use Statmaic\Facades\Site;

trait SearchFacade
{
protected function search($query, ?string $index = null, ?int $limit = 10): Collection
protected function search($query, ?string $index = null, ?int $limit = 10, ?string $site = null): Collection
{
return StatamicSearchFacade::index($index)
->ensureExists()
->search($query)
->where('site', $site ?? Site::current()->handle)
->get()
->take($limit)
->map(function ($item) {
Expand Down

0 comments on commit d982020

Please sign in to comment.