İlk temizlik tamamlandı bir önceki projeden

This commit is contained in:
Ümit Tunç
2026-04-28 21:14:25 +03:00
commit f80443aec0
10000 changed files with 959965 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
<?php
namespace App\Observers;
use App\Models\NaksCertificate;
use App\Jobs\TriggerNaksSyncJob;
use Illuminate\Support\Facades\Log;
class NaksCertificateObserver
{
/**
* Handle the NaksCertificate "updated" event.
*
* @param \App\Models\NaksCertificate $naksCertificate
* @return void
*/
public function updated(NaksCertificate $naksCertificate)
{
// Check if source_project was changed
if ($naksCertificate->wasChanged('source_project')) {
$newSource = $naksCertificate->source_project;
// If the source_project is now empty (NULL or ''), it means this project effectively
// took ownership or created a new version that should be treated as master.
// Or if we specifically want to propagate ANY change to source_project.
// The user said: "When I make 'Viksa' empty, it is saved with this project's name
// and triggers others".
// Assuming the "saved with this project's name" is logic handled elsewhere or implied
// by it being empty (Empty = This Project).
// We trigger the sync job.
Log::info("NaksCertificate updated: source_project changed to '{$newSource}'. Dispatching TriggerNaksSyncJob.");
TriggerNaksSyncJob::dispatch([
'module' => 'technology', // naks_certificates corresponds to technology module
'source_project' => config('app.name', 'Unknown Project'),
]);
}
}
}