fix: isi created_by otomatis dari auth user saat membuat transaksi kas

This commit is contained in:
2026-04-03 08:01:58 +07:00
parent 3a0373bc44
commit 3e5c048666
+7
View File
@@ -17,6 +17,13 @@ class CashRecord extends Model
'verified_at' => 'datetime', 'verified_at' => 'datetime',
]; ];
protected static function booted(): void
{
static::creating(function (CashRecord $record) {
$record->created_by ??= auth()->id();
});
}
public function category(): BelongsTo public function category(): BelongsTo
{ {
return $this->belongsTo(CashCategory::class, 'category_id'); return $this->belongsTo(CashCategory::class, 'category_id');