feat: tambah role editor, workflow post, leaderboard, rekap kehadiran, kategori kas dengan type, seeder lengkap
This commit is contained in:
@@ -9,14 +9,18 @@ class PostObserver
|
||||
{
|
||||
public function updated(Post $post): void
|
||||
{
|
||||
if ($post->wasChanged('status') && $post->status === 'published') {
|
||||
MemberPoint::create([
|
||||
'user_id' => $post->author_id,
|
||||
'points' => 5,
|
||||
'reason' => "Artikel dipublikasi: {$post->title}",
|
||||
'source_type' => 'post',
|
||||
'source_id' => $post->id,
|
||||
]);
|
||||
if ($post->wasChanged('status') && $post->status === 'approved') {
|
||||
MemberPoint::firstOrCreate(
|
||||
[
|
||||
'user_id' => $post->author_id,
|
||||
'source_type' => Post::class,
|
||||
'source_id' => $post->id,
|
||||
],
|
||||
[
|
||||
'points' => 5,
|
||||
'reason' => "Artikel disetujui: {$post->title}",
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,11 @@ class UserObserver
|
||||
|
||||
public function created(User $user): void
|
||||
{
|
||||
// Auto-assign role anggota jika belum punya role
|
||||
if ($user->roles->isEmpty()) {
|
||||
$user->assignRole('anggota');
|
||||
}
|
||||
|
||||
ActivityLog::create([
|
||||
'user_id' => Auth::id(),
|
||||
'action' => 'created',
|
||||
|
||||
Reference in New Issue
Block a user