Move remaining project metadata ownership to templates
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Models;
|
||||
|
||||
use App\Enums\NotificationChannel;
|
||||
use App\Enums\NotificationEventType;
|
||||
use App\Models\Concerns\SyncsProjectTemplateOwnership;
|
||||
use Database\Factories\NotificationActionFactory;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Attributes\Hidden;
|
||||
@@ -23,12 +24,14 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
'message_template',
|
||||
'name',
|
||||
'project_id',
|
||||
'project_template_id',
|
||||
])]
|
||||
#[Hidden(['delivery_url'])]
|
||||
class NotificationAction extends Model
|
||||
{
|
||||
/** @use HasFactory<NotificationActionFactory> */
|
||||
use HasFactory;
|
||||
use SyncsProjectTemplateOwnership;
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
@@ -45,6 +48,13 @@ class NotificationAction extends Model
|
||||
];
|
||||
}
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::saving(function (self $notificationAction): void {
|
||||
$notificationAction->syncProjectTemplateOwnership();
|
||||
});
|
||||
}
|
||||
|
||||
public function scopeEnabled(Builder $query): Builder
|
||||
{
|
||||
return $query->where('enabled', true);
|
||||
|
||||
Reference in New Issue
Block a user