Update exclusion corporate setting
This commit is contained in:
@@ -11,6 +11,7 @@ use App\Models\CorporateService;
|
||||
use App\Models\CorporatePlan;
|
||||
use App\Models\CorporateBenefit;
|
||||
use App\Models\Member;
|
||||
use App\Models\ExclusionRules;
|
||||
use App\Models\Icd;
|
||||
use App\Models\IcdTemplate;
|
||||
use App\Models\AuditTrail;
|
||||
@@ -96,6 +97,17 @@ class AppServiceProvider extends ServiceProvider
|
||||
$this->logAuditTrail($model, 'deleted');
|
||||
});
|
||||
|
||||
|
||||
// Corporate Exclusion
|
||||
ExclusionRules::updated(function ($model) {
|
||||
|
||||
$this->logAuditTrailExclusion($model, 'updated');
|
||||
});
|
||||
|
||||
ExclusionRules::deleted(function ($model) {
|
||||
$this->logAuditTrailExclusion($model, 'deleted');
|
||||
});
|
||||
|
||||
// ICD or exlusion
|
||||
Icd::updated(function ($model) {
|
||||
$this->logAuditTrail($model, 'updated');
|
||||
@@ -129,6 +141,21 @@ class AppServiceProvider extends ServiceProvider
|
||||
'user_id' => Auth::id(),
|
||||
]);
|
||||
|
||||
// Simpan jejak audit
|
||||
$auditTrail->save();
|
||||
}
|
||||
private function logAuditTrailExclusion($model, $action)
|
||||
{
|
||||
// Membuat jejak audit baru
|
||||
$auditTrail = new AuditTrail([
|
||||
'model' => get_class($model),
|
||||
'model_id' => $model->exclusion_id,
|
||||
'action' => $action,
|
||||
'old_values' => json_encode($model->getOriginal()),
|
||||
'new_values' => json_encode($model->getAttributes()),
|
||||
'user_id' => Auth::id(),
|
||||
]);
|
||||
|
||||
// Simpan jejak audit
|
||||
$auditTrail->save();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user