PHP code example of laravel-notification-channels / pagerduty
1. Go to this page and download the library: Download laravel-notification-channels/pagerduty 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/ */
laravel-notification-channels / pagerduty example snippets
use NotificationChannels\PagerDuty\PagerDutyChannel;
use NotificationChannels\PagerDuty\PagerDutyMessage;
use Illuminate\Notifications\Notification;
class SiteProblem extends Notification
{
public function via($notifiable)
{
return [PagerDutyChannel::class];
}
public function toPagerDuty($notifiable)
{
return PagerDutyMessage::create()
->setSummary('There was an error with your site in the {$notifiable->service} component.');
}
}
public function routeNotificationForPagerDuty()
{
return '99dc10c97a6e43c387bbc4f877c794ef';
}
Notification::route('PagerDuty', '[my integration key]')->notify(new BasicNotification);