| @@ 129-137 (lines=9) @@ | ||
| 126 | * @param string $order |
|
| 127 | * @return \Illuminate\Database\Eloquent\Collection |
|
| 128 | */ |
|
| 129 | public function getNotifications($limit = null, $order = 'desc') |
|
| 130 | { |
|
| 131 | $query = $this->getNotificationRelation()->orderBy('created_at', $order); |
|
| 132 | if (! is_null($limit)) { |
|
| 133 | $query->limit($limit); |
|
| 134 | } |
|
| 135 | ||
| 136 | return $query->get(); |
|
| 137 | } |
|
| 138 | ||
| 139 | /** |
|
| 140 | * Get all unread Notifications. |
|
| @@ 146-154 (lines=9) @@ | ||
| 143 | * @param string $order |
|
| 144 | * @return \Illuminate\Database\Eloquent\Collection |
|
| 145 | */ |
|
| 146 | public function getNotificationsNotRead($limit = null, $order = 'desc') |
|
| 147 | { |
|
| 148 | $query = $this->getNotificationRelation()->byRead(0)->orderBy('created_at', $order); |
|
| 149 | if (! is_null($limit)) { |
|
| 150 | $query->limit($limit); |
|
| 151 | } |
|
| 152 | ||
| 153 | return $query->get(); |
|
| 154 | } |
|
| 155 | } |
|
| 156 | ||