Total Complexity | 5 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
18 | trait HasExpiredAtHelpers |
||
19 | { |
||
20 | public function initializeHasExpiredAtHelpers(): void |
||
23 | } |
||
24 | |||
25 | public function isExpired(): bool |
||
26 | { |
||
27 | return !is_null($this->getAttributeValue('expired_at')); |
||
28 | } |
||
29 | |||
30 | public function isNotExpired(): bool |
||
31 | { |
||
32 | return !$this->isExpired(); |
||
33 | } |
||
34 | |||
35 | public function expire(): void |
||
36 | { |
||
37 | $this->setAttribute('expired_at', Date::now()); |
||
38 | $this->save(); |
||
39 | |||
40 | $this->fireModelEvent('expired', false); |
||
41 | } |
||
42 | |||
43 | public function unexpire(): void |
||
49 | } |
||
50 | } |
||
51 |