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
@@ -10,7 +10,7 @@ return new class extends Migration
{
Schema::create('cash_categories', function (Blueprint $table) {
$table->id();
$table->string('name'); // pemasukan / pengeluaran
$table->string('name'); // nama bebas, tipe dikontrol via kolom type
$table->timestamps();
});
}
@@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('cash_categories', function (Blueprint $table) {
$table->enum('type', ['pemasukan', 'pengeluaran'])->after('name')->default('pemasukan');
});
// Migrate existing data
DB::table('cash_categories')->where('name', 'pengeluaran')->update(['type' => 'pengeluaran']);
DB::table('cash_categories')->where('name', '!=', 'pengeluaran')->update(['type' => 'pemasukan']);
}
public function down(): void
{
Schema::table('cash_categories', function (Blueprint $table) {
$table->dropColumn('type');
});
}
};
@@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('posts', function (Blueprint $table) {
// Ubah enum status tambah 'approved'
$table->enum('status', ['draft', 'pending', 'approved', 'published', 'rejected'])
->default('draft')->change();
$table->foreignId('approved_by')->nullable()->constrained('users')->after('reviewed_by');
$table->timestamp('approved_at')->nullable()->after('approved_by');
});
}
public function down(): void
{
Schema::table('posts', function (Blueprint $table) {
$table->dropForeign(['approved_by']);
$table->dropColumn(['approved_by', 'approved_at']);
$table->enum('status', ['draft', 'pending', 'published', 'rejected'])
->default('draft')->change();
});
}
};