This commit is contained in:
Saufi
2026-06-02 17:35:45 +08:00
commit 4ef99b1f81
148 changed files with 21134 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
<?php
namespace App\Actions;
use App\Models\TranscriptionProject;
use App\Models\User;
use App\Services\AuditLogService;
class TransferOwnershipAction
{
public function __construct(private readonly AuditLogService $audit) {}
public function execute(TranscriptionProject $project, User $newOwner, string $justification): void
{
$oldOwner = $project->owner;
$project->update(['owner_user_id' => $newOwner->id]);
$this->audit->log('project_ownership_transferred', [
'subject_type' => TranscriptionProject::class,
'subject_id' => $project->id,
'project_id' => $project->id,
'target_user_id' => $newOwner->id,
'old_values' => [
'owner_user_id' => $oldOwner?->id,
'owner_name' => $oldOwner?->name,
],
'new_values' => [
'owner_user_id' => $newOwner->id,
'owner_name' => $newOwner->name,
],
'justification' => $justification,
]);
}
}