Move remaining project metadata ownership to templates

This commit is contained in:
2026-09-08 10:25:52 +00:00
committed by Twyco
parent 04b0d5e316
commit db8855a056
26 changed files with 473 additions and 45 deletions
+10
View File
@@ -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);