This commit is contained in:
Andras Bacsai
2023-06-01 13:24:20 +02:00
parent 0aa816b4f2
commit 6e094eaf42
10 changed files with 65 additions and 64 deletions

View File

@@ -13,30 +13,32 @@ class Team extends BaseModel implements SendsDiscord, SendsEmail
use Notifiable;
protected $casts = [
'smtp_attributes' => SchemalessAttributes::class,
'extra_attributes' => SchemalessAttributes::class,
'personal_team' => 'boolean',
];
protected $fillable = [
'id',
'name',
'personal_team',
'smtp_attributes',
'extra_attributes',
];
public function routeNotificationForDiscord()
{
return $this->smtp_attributes->get('discord_webhook');
return $this->extra_attributes->get('discord_webhook');
}
public function routeNotificationForEmail(string $attribute = 'recipients')
{
$recipients = $this->smtp_attributes->get($attribute, '');
return explode(PHP_EOL, $recipients);
$recipients = $this->extra_attributes->get($attribute, '');
if (is_null($recipients) || $recipients === '') {
return [];
}
return explode(',', $recipients);
}
public function scopeWithExtraAttributes(): Builder
{
return $this->smtp_attributes->modelScope();
return $this->extra_attributes->modelScope();
}
public function projects()