feat: tambah role editor, workflow post, leaderboard, rekap kehadiran, kategori kas dengan type, seeder lengkap

This commit is contained in:
2026-04-05 06:21:16 +07:00
parent cde63da358
commit 6c23cc8660
40 changed files with 2432 additions and 129 deletions
+7 -2
View File
@@ -8,9 +8,9 @@ use Illuminate\Support\Str;
class Post extends Model
{
protected $fillable = ['title', 'slug', 'category', 'content', 'author_id', 'published_at', 'status', 'reviewed_by', 'rejection_reason'];
protected $fillable = ['title', 'slug', 'category', 'content', 'author_id', 'published_at', 'status', 'reviewed_by', 'rejection_reason', 'approved_by', 'approved_at'];
protected $casts = ['published_at' => 'datetime'];
protected $casts = ['published_at' => 'datetime', 'approved_at' => 'datetime'];
protected static function booted(): void
{
@@ -30,6 +30,11 @@ class Post extends Model
return $this->belongsTo(User::class, 'reviewed_by');
}
public function approver(): BelongsTo
{
return $this->belongsTo(User::class, 'approved_by');
}
public function scopePublished($query)
{
return $query->where('status', 'published')