Files
trfgo/vendor/laravel/framework/src/Illuminate/Notifications/HasDatabaseNotifications.php
T
2025-03-28 08:52:46 +01:00

37 lines
809 B
PHP

<?php
namespace Illuminate\Notifications;
trait HasDatabaseNotifications
{
/**
* Get the entity's notifications.
*
* @return \Illuminate\Database\Eloquent\Relations\MorphMany<DatabaseNotification, $this>
*/
public function notifications()
{
return $this->morphMany(DatabaseNotification::class, 'notifiable')->latest();
}
/**
* Get the entity's read notifications.
*
* @return \Illuminate\Database\Query\Builder
*/
public function readNotifications()
{
return $this->notifications()->read();
}
/**
* Get the entity's unread notifications.
*
* @return \Illuminate\Database\Query\Builder
*/
public function unreadNotifications()
{
return $this->notifications()->unread();
}
}