fix: policy koordinator hilang, source_type hardcode, validasi executed_at salah kondisi
This commit is contained in:
@@ -59,7 +59,7 @@ class ParticipantsRelationManager extends RelationManager
|
||||
if (($data['status'] ?? 'hadir') === 'hadir') {
|
||||
$activity = $this->getOwnerRecord();
|
||||
MemberPoint::firstOrCreate(
|
||||
['user_id' => $data['recordId'], 'source_type' => 'activity', 'source_id' => $activity->id],
|
||||
['user_id' => $data['recordId'], 'source_type' => \App\Models\Activity::class, 'source_id' => $activity->id],
|
||||
['points' => 10, 'reason' => "Hadir di kegiatan: {$activity->title}"]
|
||||
);
|
||||
}
|
||||
@@ -70,7 +70,7 @@ class ParticipantsRelationManager extends RelationManager
|
||||
->after(function (EditAction $action, $record, array $data) {
|
||||
$activity = $this->getOwnerRecord();
|
||||
$existing = MemberPoint::where('user_id', $record->id)
|
||||
->where('source_type', 'activity')
|
||||
->where('source_type', \App\Models\Activity::class)
|
||||
->where('source_id', $activity->id)
|
||||
->first();
|
||||
|
||||
@@ -79,7 +79,7 @@ class ParticipantsRelationManager extends RelationManager
|
||||
'user_id' => $record->id,
|
||||
'points' => 10,
|
||||
'reason' => "Hadir di kegiatan: {$activity->title}",
|
||||
'source_type' => 'activity',
|
||||
'source_type' => \App\Models\Activity::class,
|
||||
'source_id' => $activity->id,
|
||||
]);
|
||||
} elseif (($data['status'] ?? 'hadir') !== 'hadir' && $existing) {
|
||||
@@ -90,7 +90,7 @@ class ParticipantsRelationManager extends RelationManager
|
||||
->after(function ($record) {
|
||||
$activity = $this->getOwnerRecord();
|
||||
MemberPoint::where('user_id', $record->id)
|
||||
->where('source_type', 'activity')
|
||||
->where('source_type', \App\Models\Activity::class)
|
||||
->where('source_id', $activity->id)
|
||||
->delete();
|
||||
}),
|
||||
@@ -100,7 +100,7 @@ class ParticipantsRelationManager extends RelationManager
|
||||
DetachBulkAction::make()
|
||||
->after(function ($records) {
|
||||
$activity = $this->getOwnerRecord();
|
||||
MemberPoint::where('source_type', 'activity')
|
||||
MemberPoint::where('source_type', \App\Models\Activity::class)
|
||||
->where('source_id', $activity->id)
|
||||
->whereIn('user_id', $records->pluck('id'))
|
||||
->delete();
|
||||
|
||||
Reference in New Issue
Block a user