| Total Complexity | 5 |
| Total Lines | 31 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | trait HasDraftedAtHelpers |
||
| 19 | { |
||
| 20 | public function initializeHasDraftedAtHelpers(): void |
||
| 23 | } |
||
| 24 | |||
| 25 | public function isDrafted(): bool |
||
| 26 | { |
||
| 27 | return !is_null($this->getAttributeValue('drafted_at')); |
||
| 28 | } |
||
| 29 | |||
| 30 | public function isNotDrafted(): bool |
||
| 33 | } |
||
| 34 | |||
| 35 | public function draft(): void |
||
| 36 | { |
||
| 37 | $this->setAttribute('drafted_at', Date::now()); |
||
| 38 | $this->save(); |
||
| 39 | |||
| 40 | $this->fireModelEvent('drafted', false); |
||
| 41 | } |
||
| 42 | |||
| 43 | public function undoDraft(): void |
||
| 49 | } |
||
| 50 | } |
||
| 51 |