| @@ 151-159 (lines=9) @@ | ||
| 148 | * @param string $order |
|
| 149 | * @return \Illuminate\Database\Eloquent\Collection |
|
| 150 | */ |
|
| 151 | public function getNotifications($limit = null, $order = 'desc') |
|
| 152 | { |
|
| 153 | $query = $this->getNotificationRelation()->orderBy('created_at', $order); |
|
| 154 | if (! is_null($limit)) { |
|
| 155 | $query->limit($limit); |
|
| 156 | } |
|
| 157 | ||
| 158 | return $query->get(); |
|
| 159 | } |
|
| 160 | ||
| 161 | /** |
|
| 162 | * Get all unread Notifications. |
|
| @@ 168-176 (lines=9) @@ | ||
| 165 | * @param string $order |
|
| 166 | * @return \Illuminate\Database\Eloquent\Collection |
|
| 167 | */ |
|
| 168 | public function getNotificationsNotRead($limit = null, $order = 'desc') |
|
| 169 | { |
|
| 170 | $query = $this->getNotificationRelation()->byRead(0)->orderBy('created_at', $order); |
|
| 171 | if (! is_null($limit)) { |
|
| 172 | $query->limit($limit); |
|
| 173 | } |
|
| 174 | ||
| 175 | return $query->get(); |
|
| 176 | } |
|
| 177 | } |
|
| 178 | ||