Skip to content

Commit ef57405

Browse files
authored
Update README.md
1 parent 4186517 commit ef57405

File tree

1 file changed

+4
-28
lines changed

1 file changed

+4
-28
lines changed

README.md

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ Consider to **clear the cache** whenever you make a new **deployment/migration**
8181

8282
---
8383

84-
#### `fromToday`
84+
#### `fromToday`, `fromYesterday`
8585

86-
Select all entries created today.
86+
Select all entries created today or yesterday.
8787

8888
```php
8989
use LaracraftTech\LaravelUsefulTraits\UsefulScopes;
@@ -99,32 +99,8 @@ $class = new class extends Model
9999
$class->create(['foo' => 'foo1', 'bar' => 'bar1', 'quz' => 'quz1']);
100100
$class->create(['foo' => 'foo2', 'bar' => 'bar2', 'quz' => 'quz2', 'created_at' => now()->yesterday()]);
101101

102-
$class::select('foo')->fromToday()->first()->toArray();
103-
// return ['foo' => 'foo1']
104-
```
105-
106-
---
107-
108-
#### `fromYesterday`
109-
110-
Select all entries created yesterday.
111-
112-
```php
113-
use LaracraftTech\LaravelUsefulTraits\UsefulScopes;
114-
115-
$class = new class extends Model
116-
{
117-
use UsefulScopes;
118-
119-
protected $timestamps = true;
120-
protected $table = 'scope_tests';
121-
};
122-
123-
$class->create(['foo' => 'foo1', 'bar' => 'bar1', 'quz' => 'quz1']);
124-
$class->create(['foo' => 'foo2', 'bar' => 'bar2', 'quz' => 'quz2', 'created_at' => now()->yesterday()]);
125-
126-
$class::select('foo')->fromYesterday()->first()->toArray();
127-
// return ['foo' => 'foo2']
102+
$class::select('foo')->fromToday()->first()->toArray(); // return ['foo' => 'foo1']
103+
$class::select('foo')->fromYesterday()->first()->toArray(); // return ['foo' => 'foo2']
128104
```
129105

130106
## Testing

0 commit comments

Comments
 (0)