Files
apimacro/vendor/laravel/framework/src/Illuminate/Notifications/HasDatabaseNotifications.php

37 lines
801 B
PHP
Raw Normal View History

2024-05-07 12:17:25 +02:00
<?php
namespace Illuminate\Notifications;
trait HasDatabaseNotifications
{
/**
* Get the entity's notifications.
*
* @return \Illuminate\Database\Eloquent\Relations\MorphMany
*/
public function notifications()
{
return $this->morphMany(DatabaseNotification::class, 'notifiable')->orderBy('created_at', 'desc');
}
/**
* Get the entity's read notifications.
*
* @return \Illuminate\Database\Query\Builder
*/
public function readNotifications()
{
2024-08-13 13:44:16 +00:00
return $this->notifications()->read();
2024-05-07 12:17:25 +02:00
}
/**
* Get the entity's unread notifications.
*
* @return \Illuminate\Database\Query\Builder
*/
public function unreadNotifications()
{
2024-08-13 13:44:16 +00:00
return $this->notifications()->unread();
2024-05-07 12:17:25 +02:00
}
}