Skip to content

Commit 1ee042a

Browse files
authored
Update README.md
1 parent 85291c0 commit 1ee042a

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

README.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,30 @@
1010
This package extends Laravel's Eloquent model and query builder with seamless integration of Elasticsearch functionalities. Designed to feel native to Laravel, this package enables you to work with Eloquent models while leveraging the
1111
powerful search and analytics capabilities of Elasticsearch.
1212

13+
Example:
1314
```php
14-
$logs = UserLog::where('type', UserLogType::LOGIN)->where('created_at','>=',Carbon::now()->subDays(30))->get();
15+
$logs = UserLog::where('created_at','>=',Carbon::now()->subDays(30))->get();
1516
```
17+
```php
18+
$updates = UserLog::where('status', 1)->update(['status' => 4]);
19+
```
20+
```php
21+
$profiles = UserProfile::whereIn('country_code',['US','CA'])->orderByDesc('last_login')->take(10)->get();
22+
```
23+
```php
24+
$deleted = UserProfile::where('state','unsubscribed')->where('updated_at','<=',Carbon::now()->subDays(90)->delete();
25+
```
26+
```php
27+
$search = UserProfile::term('loves espressos')->minShouldMatch(2)->highlight()->search();
28+
```
29+
1630

1731
### Read the [Documentation](https://elasticsearch.pdphilip.com/)
1832
---
1933
> #### Using [OpenSearch](https://opensearch.pdphilip.com/)? [Github](https://github.com/pdphilip/laravel-opensearch)
2034
---
21-
35+
> #### [Package Tests](https://github.com/pdphilip/laravel-elasticsearch-tests)
36+
---
2237
## Installation
2338

2439
### Maintained versions (Elasticsearch 8.x):
@@ -242,4 +257,4 @@ Now, you're all set to use Elasticsearch with Laravel as if it were native to th
242257

243258
- [Grouped Queries](https://elasticsearch.pdphilip.com/querying-models#grouped-queries): Queries can be grouped allowing multiple conditions to be nested within a single query block.
244259

245-
---
260+
---

0 commit comments

Comments
 (0)