<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
syropian / laravel-notification-channel-throttling example snippets
use Illuminate\Notifications\Notification;
use Syropian\LaravelNotificationChannelThrottling\Contracts\ThrottlesChannels;
class ExampleNotification extends Notification implements ThrottlesChannels {
// ...
public function throttleChannels(object $notifiable, array $channels): array
{
/**
* Throttle the mail channel, so that only one
* email notification is sent every 15 minutes
*/
return [
'mail' => [
'maxAttempts' => 1,
'decaySeconds' => 900,
],
'database' => false,
];
}
}
public function __construct(public Post $post) {}
public function throttleChannels(object $notifiable, array $channels): array
{
return [
'mail' => [
'key' => $notifiable->id . ':' . $this->post->id,
'maxAttempts' => 1,
'decaySeconds' => 900,
],
'database' => false,
];
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.