File tree Expand file tree Collapse file tree 2 files changed +14
-10
lines changed
tests/fixtures/ServiceGeneratorTest Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change 11namespace {{ $namespace } } ;
22
33use {{ $modelsNamespace } } \{{ $entity } } ;
4+ use Illuminate\Pagination\LengthAwarePaginator;
45use RonasIT\Support\Traits\EntityControlTrait;
56{{--
67 Laravel inserts two spaces between @property and type, so we are forced
@@ -23,15 +24,16 @@ public function __construct()
2324 $this->setModel({{ $entity } } ::class);
2425 }
2526
26- public function search($filters)
27+ public function search($filters): LengthAwarePaginator
2728 {
28- return $this->searchQuery($filters)
29+ return $this
30+ ->searchQuery($filters)
2931@foreach ($fields [' simple_search' ] as $field )
30- ->filterBy('{{ $field } } ')
32+ ->filterBy('{{ $field } } ')
3133@endforeach
3234@if (! empty ($fields [' search_by_query' ]) )
33- ->filterByQuery(['{!! implode (' \' , \' ' , $fields [' search_by_query' ]) ! !} '])
35+ ->filterByQuery(['{!! implode (' \' , \' ' , $fields [' search_by_query' ]) ! !} '])
3436@endif
35- ->getSearchResults();
37+ ->getSearchResults();
3638 }
3739}
Original file line number Diff line number Diff line change 33namespace App \Services ;
44
55use App \Models \Post ;
6+ use Illuminate \Pagination \LengthAwarePaginator ;
67use RonasIT \Support \Traits \EntityControlTrait ;
78
89/**
@@ -17,11 +18,12 @@ public function __construct()
1718 $ this ->setModel (Post::class);
1819 }
1920
20- public function search ($ filters )
21+ public function search ($ filters ): LengthAwarePaginator
2122 {
22- return $ this ->searchQuery ($ filters )
23- ->filterBy ('media_id ' )
24- ->filterByQuery (['title ' , 'body ' ])
25- ->getSearchResults ();
23+ return $ this
24+ ->searchQuery ($ filters )
25+ ->filterBy ('media_id ' )
26+ ->filterByQuery (['title ' , 'body ' ])
27+ ->getSearchResults ();
2628 }
2729}
You can’t perform that action at this time.
0 commit comments