akaunting / laravel-firewall

Web Application Firewall (WAF) package for Laravel
https://akaunting.com
MIT License
941 stars 104 forks source link

[FEATURE REQUEST] implementing support for custom notification channels #70

Open Carnicero90 opened 1 year ago

Carnicero90 commented 1 year ago

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) );`