4
4
5
5
use Illuminate \Support \Collection ;
6
6
use Illuminate \Support \Traits \ForwardsCalls ;
7
- use ProtoneMedia \LaravelCrossEloquentSearch \Contracts \SearcherContract ;
8
7
9
- class SearchFactory implements SearcherContract
8
+ class SearchFactory
10
9
{
11
10
use ForwardsCalls;
12
11
@@ -21,127 +20,127 @@ public function new(): Searcher
21
20
/**
22
21
* Add a model to search through.
23
22
*/
24
- public function add ($ query , $ columns = null , string $ orderByColumn = null ): SearcherContract
23
+ public function add ($ query , $ columns = null , string $ orderByColumn = null ): Searcher
25
24
{
26
25
return $ this ->new ()->add ($ query , $ columns , $ orderByColumn );
27
26
}
28
27
29
28
/**
30
29
* Add a full-text searchable model.
31
30
*/
32
- public function addFullText ($ query , $ columns = null , array $ options = [], string $ orderByColumn = null ): SearcherContract
31
+ public function addFullText ($ query , $ columns = null , array $ options = [], string $ orderByColumn = null ): Searcher
33
32
{
34
33
return $ this ->new ()->addFullText ($ query , $ columns , $ options , $ orderByColumn );
35
34
}
36
35
37
36
/**
38
37
* Add multiple models at once.
39
38
*/
40
- public function addMany (array $ queries ): SearcherContract
39
+ public function addMany (array $ queries ): Searcher
41
40
{
42
41
return $ this ->new ()->addMany ($ queries );
43
42
}
44
43
45
44
/**
46
45
* Set the order by column for the most recently added model.
47
46
*/
48
- public function orderBy (string $ orderByColumn ): SearcherContract
47
+ public function orderBy (string $ orderByColumn ): Searcher
49
48
{
50
49
return $ this ->new ()->orderBy ($ orderByColumn );
51
50
}
52
51
53
52
/**
54
53
* Order results in ascending order.
55
54
*/
56
- public function orderByAsc (): SearcherContract
55
+ public function orderByAsc (): Searcher
57
56
{
58
57
return $ this ->new ()->orderByAsc ();
59
58
}
60
59
61
60
/**
62
61
* Order results in descending order.
63
62
*/
64
- public function orderByDesc (): SearcherContract
63
+ public function orderByDesc (): Searcher
65
64
{
66
65
return $ this ->new ()->orderByDesc ();
67
66
}
68
67
69
68
/**
70
69
* Order results by relevance.
71
70
*/
72
- public function orderByRelevance (): SearcherContract
71
+ public function orderByRelevance (): Searcher
73
72
{
74
73
return $ this ->new ()->orderByRelevance ();
75
74
}
76
75
77
76
/**
78
77
* Order results by model type.
79
78
*/
80
- public function orderByModel ($ modelClasses ): SearcherContract
79
+ public function orderByModel ($ modelClasses ): Searcher
81
80
{
82
81
return $ this ->new ()->orderByModel ($ modelClasses );
83
82
}
84
83
85
84
/**
86
85
* Configure wildcard behavior.
87
86
*/
88
- public function beginWithWildcard (bool $ state = true ): SearcherContract
87
+ public function beginWithWildcard (bool $ state = true ): Searcher
89
88
{
90
89
return $ this ->new ()->beginWithWildcard ($ state );
91
90
}
92
91
93
92
/**
94
93
* Configure wildcard behavior.
95
94
*/
96
- public function endWithWildcard (bool $ state = true ): SearcherContract
95
+ public function endWithWildcard (bool $ state = true ): Searcher
97
96
{
98
97
return $ this ->new ()->endWithWildcard ($ state );
99
98
}
100
99
101
100
/**
102
101
* Enable case-insensitive searching.
103
102
*/
104
- public function ignoreCase (bool $ state = true ): SearcherContract
103
+ public function ignoreCase (bool $ state = true ): Searcher
105
104
{
106
105
return $ this ->new ()->ignoreCase ($ state );
107
106
}
108
107
109
108
/**
110
109
* Enable sounds like searching.
111
110
*/
112
- public function soundsLike (bool $ state = true ): SearcherContract
111
+ public function soundsLike (bool $ state = true ): Searcher
113
112
{
114
113
return $ this ->new ()->soundsLike ($ state );
115
114
}
116
115
117
116
/**
118
117
* Configure term parsing.
119
118
*/
120
- public function parseTerm (bool $ state = true ): SearcherContract
119
+ public function parseTerm (bool $ state = true ): Searcher
121
120
{
122
121
return $ this ->new ()->parseTerm ($ state );
123
122
}
124
123
125
124
/**
126
125
* Configure pagination.
127
126
*/
128
- public function paginate (int $ perPage = 15 , string $ pageName = 'page ' , int $ page = null ): SearcherContract
127
+ public function paginate (int $ perPage = 15 , string $ pageName = 'page ' , int $ page = null ): Searcher
129
128
{
130
129
return $ this ->new ()->paginate ($ perPage , $ pageName , $ page );
131
130
}
132
131
133
132
/**
134
133
* Configure simple pagination.
135
134
*/
136
- public function simplePaginate (int $ perPage = 15 , string $ pageName = 'page ' , int $ page = null ): SearcherContract
135
+ public function simplePaginate (int $ perPage = 15 , string $ pageName = 'page ' , int $ page = null ): Searcher
137
136
{
138
137
return $ this ->new ()->simplePaginate ($ perPage , $ pageName , $ page );
139
138
}
140
139
141
140
/**
142
141
* Include model type in results.
143
142
*/
144
- public function includeModelType (string $ key = 'type ' ): SearcherContract
143
+ public function includeModelType (string $ key = 'type ' ): Searcher
145
144
{
146
145
return $ this ->new ()->includeModelType ($ key );
147
146
}
0 commit comments