feat: tambah budget kegiatan dengan alur threshold approval/voting

This commit is contained in:
2026-04-05 23:18:49 +07:00
parent cbadc550fc
commit 4106eae5cf
6 changed files with 73 additions and 2 deletions
+6 -1
View File
@@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
class Activity extends Model
{
protected $fillable = [
'title', 'description', 'start_date', 'end_date',
'title', 'description', 'budget', 'start_date', 'end_date',
'created_by', 'status', 'approved_by', 'approved_at',
'executed_at', 'execution_notes',
];
@@ -44,4 +44,9 @@ class Activity extends Model
return $this->belongsToMany(User::class, 'activity_member')
->withPivot('status', 'notes');
}
public function cashRecords(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(CashRecord::class);
}
}
+7 -1
View File
@@ -4,11 +4,12 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use App\Models\Activity;
class CashRecord extends Model
{
protected $fillable = [
'amount', 'category_id', 'description',
'amount', 'category_id', 'activity_id', 'description',
'date', 'created_by', 'verified_by', 'verified_at',
];
@@ -29,6 +30,11 @@ class CashRecord extends Model
return $this->belongsTo(CashCategory::class, 'category_id');
}
public function activity(): BelongsTo
{
return $this->belongsTo(Activity::class);
}
public function creator(): BelongsTo
{
return $this->belongsTo(User::class, 'created_by');