feat: slack notifications

This commit is contained in:
Marvin von Rappard
2024-11-12 22:37:55 +01:00
parent 9af3fe9c97
commit eb0686fe20
27 changed files with 822 additions and 181 deletions

View File

@@ -4,6 +4,7 @@ namespace App\Models;
use App\Notifications\Channels\SendsDiscord;
use App\Notifications\Channels\SendsEmail;
use App\Notifications\Channels\SendsSlack;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
@@ -70,7 +71,7 @@ use OpenApi\Attributes as OA;
),
]
)]
class Team extends Model implements SendsDiscord, SendsEmail
class Team extends Model implements SendsDiscord, SendsEmail, SendsSlack
{
use Notifiable;
@@ -127,6 +128,11 @@ class Team extends Model implements SendsDiscord, SendsEmail
];
}
public function routeNotificationForSlack()
{
return data_get($this, 'slack_webhook_url', null);
}
public function getRecepients($notification)
{
$recipients = data_get($notification, 'emails', null);
@@ -161,7 +167,7 @@ class Team extends Model implements SendsDiscord, SendsEmail
return 9999999;
}
$team = Team::find(currentTeam()->id);
if (! $team) {
if (!$team) {
return 0;
}