[FEATURE REQUEST] implementing support for custom notification channels #70
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Kinda built-in support for custom notifications. Had to change viaQueues as well to make it compatible with this commit.
Sample Usage:
`<?php
class customFWChannel {
public function send($notifiable, \Akaunting\Firewall\Notifications\AttackDetected $a) {
\Log::debug('sending to a custom channel');
}
}
config()->set('firewall.notifications.custom', [
'enabled' => true,
'channel' => customFWChannel::class,
'queue' => 'customqueue'
]);
$fakeAttack = (object) [
"ip" => "192.168.240.1",
"level" => "medium",
"middleware" => "url",
"user_id" => 0,
"url" => "http://localhost/admin",
"referrer" => "NULL",
"request" => "",
"updated_at" => "2023-10-02T08:53:24.000000Z",
"created_at" => "2023-10-02T08:53:24.000000Z",
"id" => 61
];
(new \Akaunting\Firewall\Notifications\Notifiable)->notify(
new \Akaunting\Firewall\Notifications\AttackDetected($fakeAttack)
);`