Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
UpdateResentAt | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
bootUpdateResentAt | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace App\Traits; |
4 | |
5 | use MongoDB\BSON\UTCDateTime; |
6 | |
7 | trait UpdateResentAt |
8 | { |
9 | public static function bootUpdateResentAt() |
10 | { |
11 | // updating resent_at when model is created |
12 | static::creating(function ($model) { |
13 | $model->resent_at = new UTCDateTime(now()); |
14 | }); |
15 | |
16 | // updating resent_at when model is updated |
17 | static::updating(function ($model) { |
18 | $model->resent_at = new UTCDateTime(now()); |
19 | }); |
20 | } |
21 | } |