| @@ 22-29 (lines=8) @@ | ||
| 19 | * @throws \Exception |
|
| 20 | * @throws \Throwable |
|
| 21 | */ |
|
| 22 | public function markAsRead() |
|
| 23 | { |
|
| 24 | /** @var ActiveRecordInterface $model */ |
|
| 25 | $model = $this->owner; |
|
| 26 | if (is_null($model->{$this->readAttribute})) { |
|
| 27 | $model->update(false, [$this->readAttribute => date('Y-m-d H:i:s')]); |
|
| 28 | } |
|
| 29 | } |
|
| 30 | ||
| 31 | /** |
|
| 32 | * Mark the notification as unread. |
|
| @@ 37-44 (lines=8) @@ | ||
| 34 | * @throws \Exception |
|
| 35 | * @throws \Throwable |
|
| 36 | */ |
|
| 37 | public function markAsUnread() |
|
| 38 | { |
|
| 39 | /** @var ActiveRecordInterface $model */ |
|
| 40 | $model = $this->owner; |
|
| 41 | if (!is_null($model->{$this->readAttribute})) { |
|
| 42 | $model->update(false, [$this->readAttribute => null]); |
|
| 43 | } |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * Determine if a notification has been read. |
|