Primo Committ
This commit is contained in:
36
vendor/laravel/framework/src/Illuminate/Notifications/HasDatabaseNotifications.php
vendored
Normal file
36
vendor/laravel/framework/src/Illuminate/Notifications/HasDatabaseNotifications.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?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()
|
||||
{
|
||||
return $this->notifications()->whereNotNull('read_at');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the entity's unread notifications.
|
||||
*
|
||||
* @return \Illuminate\Database\Query\Builder
|
||||
*/
|
||||
public function unreadNotifications()
|
||||
{
|
||||
return $this->notifications()->whereNull('read_at');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user