Skip to content

Commit 3e95445

Browse files
authored
Merge pull request #251 from RodrigoTroche/patch-1
Update README.md. Adding via Query example
2 parents 57388ba + 408dae5 commit 3e95445

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,23 @@ class PostController extends Controller
185185
}
186186
```
187187

188+
## Adding via Query
189+
The `searchable()` method will chunk the results of the query and add the records to your search index.
190+
191+
$post = Post::find(1);
192+
193+
// You may also add record via collection...
194+
$post->searchable();
195+
196+
// OR
197+
198+
$posts = Post::where('year', '>', '2018')->get();
199+
200+
// You may also add records via collections...
201+
$posts->searchable();
202+
203+
When using constraints apply it after the constraints are added to the query, as seen in the above example.
204+
188205
## OrderBy
189206
An `orderBy()` statement can now be applied to the search query similar to the `where()` statement.
190207

0 commit comments

Comments
 (0)