feat: tambah role editor, workflow post, leaderboard, rekap kehadiran, kategori kas dengan type, seeder lengkap
This commit is contained in:
@@ -7,7 +7,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class CashCategory extends Model
|
||||
{
|
||||
protected $fillable = ['name'];
|
||||
protected $fillable = ['name', 'type'];
|
||||
|
||||
public function records(): HasMany
|
||||
{
|
||||
|
||||
+7
-2
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user