Skip to content

Commit df39de8

Browse files
committed
Merge branch 'main' of github.com:laracraft-tech/laravel-useful-traits into main
2 parents 29ade28 + ef57405 commit df39de8

File tree

2 files changed

+8
-28
lines changed

2 files changed

+8
-28
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to `laravel-useful-traits` will be documented in this file.
44

5+
## v1.0.2 - 2023-02-02
6+
7+
v1.0.2
8+
59
## v1.0.1 - 2023-02-01
610

711
v1.0.1

README.md

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

8888
---
8989

90-
#### `fromToday`
90+
#### `fromToday`, `fromYesterday`
9191

92-
Select all entries created today.
92+
Select all entries created today or yesterday.
9393

9494
```php
9595
use LaracraftTech\LaravelUsefulTraits\UsefulScopes;
@@ -105,32 +105,8 @@ $class = new class extends Model
105105
$class->create(['foo' => 'foo1', 'bar' => 'bar1', 'quz' => 'quz1']);
106106
$class->create(['foo' => 'foo2', 'bar' => 'bar2', 'quz' => 'quz2', 'created_at' => now()->yesterday()]);
107107

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

136112
### RefreshDatabaseFast

0 commit comments

Comments
 (0)