| @@ 67-78 (lines=12) @@ | ||
| 64 | * @param int $notification |
|
| 65 | * @return bool |
|
| 66 | */ |
|
| 67 | public function readNotification($notification) |
|
| 68 | { |
|
| 69 | if (! TypeChecker::isNotification($notification, false)) { |
|
| 70 | $notification = $this->notifications()->firstOrFail($notification); |
|
| 71 | } |
|
| 72 | ||
| 73 | if ($this->notifications()->where($notification->getKeyName(), $notification->getKey())->exists()) { |
|
| 74 | return $notification->read(); |
|
| 75 | } |
|
| 76 | ||
| 77 | return false; |
|
| 78 | } |
|
| 79 | ||
| 80 | /** |
|
| 81 | * Read all Notifications. |
|
| @@ 96-107 (lines=12) @@ | ||
| 93 | * @param int $notification |
|
| 94 | * @return bool |
|
| 95 | */ |
|
| 96 | public function unreadNotification($notification) |
|
| 97 | { |
|
| 98 | if (! TypeChecker::isNotification($notification, false)) { |
|
| 99 | $notification = $this->notifications()->firstOrFail($notification); |
|
| 100 | } |
|
| 101 | ||
| 102 | if ($this->notifications()->where($notification->getKeyName(), $notification->getKey())->exists()) { |
|
| 103 | return $notification->unread(); |
|
| 104 | } |
|
| 105 | ||
| 106 | return false; |
|
| 107 | } |
|
| 108 | ||
| 109 | /** |
|
| 110 | * Unread all Notifications. |
|