Move remaining project metadata ownership to templates
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Models;
|
||||
|
||||
use App\Actions\Git\Data\GitRepository;
|
||||
use App\Actions\Git\GitProviderKey;
|
||||
use App\Models\Concerns\SyncsProjectTemplateOwnership;
|
||||
use Database\Factories\RepositoryConnectionFactory;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
@@ -14,6 +15,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
'base_url',
|
||||
'owner_name',
|
||||
'project_id',
|
||||
'project_template_id',
|
||||
'provider',
|
||||
'provider_repository_id',
|
||||
'repository_full_name',
|
||||
@@ -24,6 +26,7 @@ class RepositoryConnection extends Model
|
||||
{
|
||||
/** @use HasFactory<RepositoryConnectionFactory> */
|
||||
use HasFactory;
|
||||
use SyncsProjectTemplateOwnership;
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
@@ -35,6 +38,13 @@ class RepositoryConnection extends Model
|
||||
];
|
||||
}
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::saving(function (self $repositoryConnection): void {
|
||||
$repositoryConnection->syncProjectTemplateOwnership();
|
||||
});
|
||||
}
|
||||
|
||||
public function project(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Project::class);
|
||||
|
||||
Reference in New Issue
Block a user