feat: tambah fitur iuran anggota (MemberDue)

This commit is contained in:
2026-04-04 04:06:00 +07:00
parent 3fd286ac22
commit 003cadfba9
8 changed files with 209 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class MemberDue extends Model
{
protected $fillable = [
'user_id', 'amount', 'period', 'status', 'paid_at', 'notes', 'created_by',
];
protected $casts = [
'paid_at' => 'date',
];
protected static function booted(): void
{
static::creating(function (MemberDue $due) {
$due->created_by ??= auth()->id();
});
}
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
public function creator(): BelongsTo
{
return $this->belongsTo(User::class, 'created_by');
}
}