- Fitur: input pelanggaran, sistem poin, surat peringatan otomatis, SP progress - Realtime notifikasi via Laravel Reverb + Echo - Dashboard statistik, manajemen user, manajemen master data - Login 2 kolom premium, user dropdown, pengaturan akun - Tema biru kalem, logo sekolah dinamis, sidebar brand dinamis - Sinkronisasi siswa dari Database Kesiswaan via API
37 lines
1.3 KiB
PHP
37 lines
1.3 KiB
PHP
<?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::create('notifications', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('user_id')->nullable()->constrained()->cascadeOnDelete();
|
|
$table->string('type'); // violation_recorded, sp_generated, threshold_reached
|
|
$table->string('title');
|
|
$table->text('body')->nullable();
|
|
$table->json('data')->nullable();
|
|
$table->string('icon')->nullable();
|
|
$table->string('color')->nullable();
|
|
$table->string('action_url')->nullable();
|
|
$table->boolean('is_read')->default(false);
|
|
$table->timestamp('read_at')->nullable();
|
|
$table->foreignId('violation_id')->nullable()->constrained()->nullOnDelete();
|
|
$table->foreignId('sp_letter_id')->nullable()->constrained('sp_letters')->nullOnDelete();
|
|
$table->timestamps();
|
|
|
|
$table->index(['user_id', 'is_read']);
|
|
$table->index('created_at');
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('notifications');
|
|
}
|
|
};
|