add alersts api

This commit is contained in:
2024-11-26 01:16:49 +05:00
parent 55060d1ad2
commit 5d5e269285
6 changed files with 116 additions and 1 deletions

View File

@@ -196,5 +196,14 @@ class LoanOrder extends Model
static::creating(LoanOrderRepo::creating());
static::created(LoanOrderRepo::created());
static::updated(function (LoanOrder $model) {
info($model->notes);
if ($model->notes && $model->wasChanged('notes')) {
auth()->user()->alerts()->create([
'name' => 'Duýdyryş',
'value' => $model->notes,
]);
}
});
}
}