feat: anggota dapat menulis artikel dengan workflow approval sebelum diterbitkan
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?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) {
|
||||
$table->enum('status', ['draft', 'pending', 'published', 'rejected'])
|
||||
->default('draft')->after('author_id');
|
||||
$table->foreignId('reviewed_by')->nullable()->constrained('users')->after('status');
|
||||
$table->text('rejection_reason')->nullable()->after('reviewed_by');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('posts', function (Blueprint $table) {
|
||||
$table->dropColumn(['status', 'reviewed_by', 'rejection_reason']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -36,10 +36,11 @@ class PermissionSeeder extends Seeder
|
||||
->orWhere('name', 'like', 'View:Division')
|
||||
->get());
|
||||
|
||||
// Anggota: hanya lihat kegiatan & voting
|
||||
// Anggota: lihat kegiatan & voting + kelola artikel sendiri
|
||||
$anggota->syncPermissions(Permission::whereIn('name', [
|
||||
'ViewAny:Activity', 'View:Activity',
|
||||
'ViewAny:Vote', 'View:Vote',
|
||||
'ViewAny:MyPost', 'View:MyPost', 'Create:MyPost', 'Update:MyPost', 'Delete:MyPost',
|
||||
])->get());
|
||||
|
||||
// Auditor: read-only semua + akses audit
|
||||
|
||||
@@ -36,7 +36,7 @@ class PostSeeder extends Seeder
|
||||
foreach ($posts as $data) {
|
||||
Post::firstOrCreate(
|
||||
['slug' => \Illuminate\Support\Str::slug($data['title'])],
|
||||
array_merge($data, ['author_id' => $author->id])
|
||||
array_merge($data, ['author_id' => $author->id, 'status' => 'published'])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user