PHP code example of herpaderpaldent / seat-notifications
1. Go to this page and download the library: Download herpaderpaldent/seat-notifications library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
herpaderpaldent / seat-notifications example snippets
public function handle()
{
Redis::funnel('soft_delete:refresh_token_' . $this->refresh_token->user->id)->limit(1)->then(function () {
logger()->info('SoftDelete detected of ' . $this->refresh_token->user->name);
$recipients = NotificationRecipient::all()
->filter(function ($recipient) {
return $recipient->shouldReceive(AbstractRefreshTokenNotification::class);
});
if($recipients->isEmpty()){
logger()->debug('No Receiver found for this Notification. This job is going to be deleted.');
$this->delete();
}
$recipients->groupBy('driver')
->each(function ($grouped_recipients) {
$driver = (string) $grouped_recipients->first()->driver;
$notification_class = AbstractRefreshTokenNotification::getDriverImplementation($driver);
Notification::send($grouped_recipients, (new $notification_class($this->refresh_token)));
});
}, function () {
logger()->debug('A Soft-Delete job is already running for ' . $this->refresh_token->user->name);
$this->delete();
});
}