[], ]; /** * Mark the notification as read. * * @return void */ public function markAsRead() { if (is_null($this->read_at)) { $this->forceFill(['read_at' => $this->freshTimestamp()])->save(); } } /** * Determine if a notification has been read. * * @return bool */ public function read() { return $this->read_at !== null; } /** * Determine if a notification has not been read. * * @return bool */ public function unread() { return $this->read_at === null; } /** * Get the entity's unread notifications. */ public function scopeApplyUnread($query) { return $query->whereNull('read_at'); } /** * Get the entity's read notifications. */ public function scopeApplyRead($query) { return $query->whereNotNull('read_at'); } /** * Get the parsed body of the announcement. * * @return string */ public function getParsedBodyAttribute() { return Markdown::parse($this->body); } }