Notification
class Notification extends Model
A notification to a player
Traits
Constants
TABLE |
The name of the database table used for queries |
Methods
Enter a new notification into the database
Show a list of notifications for a specific user
Show the number of notifications the user hasn't read yet
Get the receiving player of the notification
Get the type of the notification
Finds if the notification has been read by the user
Mark the notification as read by the user
Make sure that the user is shown the notification immediately if they are browsing
Get the available actions for the notification
Push an event to the event adapters
Initialize the external push adapters
Get the possible statuses representing an active model (visible to everyone)
Get a query builder for notifications
Details
at line line 86
static Notification
newNotification(int $receiver, string $type, Event $event, string $timestamp = 'now', string $status = 'unread')
Enter a new notification into the database
at line line 105
static Notification[]
getNotifications(int $receiver, bool $onlyUnread = false)
Show a list of notifications for a specific user
at line line 123
static int
countUnreadNotifications(int $receiver)
Show the number of notifications the user hasn't read yet
at line line 134
Player
getReceiver()
Get the receiving player of the notification
at line line 146
int
getCategory()
Get the type of the notification
Do not use Notification::getType(), as it returns the name of the class (i.e. notification)
at line line 155
Event
getEvent()
Get the event of the notification
at line line 166
bool
isRead()
Finds if the notification has been read by the user
This returns true even if the notification is deleted
at line line 175
void
markAsRead()
Mark the notification as read by the user
at line line 188
push()
Make sure that the user is shown the notification immediately if they are browsing
at line line 199
array
getActions(bool $email = false)
Get the available actions for the notification
at line line 217
static void
pushEvent(string $type, mixed $data = null)
Push an event to the event adapters
at line line 251
static void
initializeAdapters()
Initialize the external push adapters
at line line 272
static string[]
getActiveStatuses()
Get the possible statuses representing an active model (visible to everyone)
at line line 281
static NotificationQueryBuilder
getQueryBuilder()
Get a query builder for notifications