mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Add NotificationObserver
This commit is contained in:
parent
b3a9587756
commit
64462cdb94
1 changed files with 64 additions and 0 deletions
64
app/Observers/NotificationObserver.php
Normal file
64
app/Observers/NotificationObserver.php
Normal file
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
namespace App\Observers;
|
||||
|
||||
use App\Notification;
|
||||
use App\Services\NotificationService;
|
||||
|
||||
class NotificationObserver
|
||||
{
|
||||
/**
|
||||
* Handle the notification "created" event.
|
||||
*
|
||||
* @param \App\Notification $notification
|
||||
* @return void
|
||||
*/
|
||||
public function created(Notification $notification)
|
||||
{
|
||||
NotificationService::set($notification->profile_id, $notification->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the notification "updated" event.
|
||||
*
|
||||
* @param \App\Notification $notification
|
||||
* @return void
|
||||
*/
|
||||
public function updated(Notification $notification)
|
||||
{
|
||||
NotificationService::set($notification->profile_id, $notification->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the notification "deleted" event.
|
||||
*
|
||||
* @param \App\Notification $notification
|
||||
* @return void
|
||||
*/
|
||||
public function deleted(Notification $notification)
|
||||
{
|
||||
NotificationService::del($notification->profile_id, $notification->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the notification "restored" event.
|
||||
*
|
||||
* @param \App\Notification $notification
|
||||
* @return void
|
||||
*/
|
||||
public function restored(Notification $notification)
|
||||
{
|
||||
NotificationService::set($notification->profile_id, $notification->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the notification "force deleted" event.
|
||||
*
|
||||
* @param \App\Notification $notification
|
||||
* @return void
|
||||
*/
|
||||
public function forceDeleted(Notification $notification)
|
||||
{
|
||||
NotificationService::del($notification->profile_id, $notification->id);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue