fix: isi created_by otomatis dari auth user saat membuat transaksi kas
This commit is contained in:
@@ -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');
|
||||||
|
|||||||
Reference in New Issue
Block a user