update kode

This commit is contained in:
nylaaptr 2026-07-18 13:01:51 +07:00
parent 1c22c2883e
commit a6b428e805
17 changed files with 646 additions and 164 deletions

View File

@ -1,49 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->longText('payload');
$table->integer('last_activity')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('sessions');
}
};

View File

@ -0,0 +1,47 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('user', function (Blueprint $table) {
$table->increments('id_user');
$table->string('nama_user');
$table->string('no_hp', 15);
$table->string('email_user')->unique();
$table->string('password_user', 100);
$table->enum('role_user', [
'admin',
'customer'
]);
$table->string('profile_photo')->nullable();
$table->timestamps();
$table->string('google_id')->nullable();
$table->text('google_avatar')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('user');
}
};

View File

@ -1,29 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up()
{
Schema::table('user', function ($table) {
$table->string('google_id')->nullable();
$table->text('google_avatar')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('user', function (Blueprint $table) {
//
});
}
};

View File

@ -1,23 +0,0 @@
<?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('dokumen', function (Blueprint $table) {
$table->unsignedBigInteger('id_transaksi')
->after('id_user');
});
}
public function down(): void
{
Schema::table('dokumen', function (Blueprint $table) {
$table->dropColumn('id_transaksi');
});
}
};

View File

@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('chat_messages', function (Blueprint $table) {
$table->json('properti_data')
->nullable()
->after('message');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('chat_messages', function (Blueprint $table) {
//
});
}
};

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('perumahan', function (Blueprint $table) {
$table->increments('id_perumahan');
$table->string('nama_perumahan');
$table->string('lokasi_perumahan');
$table->decimal('latitude', 10, 7)->nullable();
$table->decimal('longitude', 10, 7)->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('perumahan');
}
};

View File

@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('blok', function (Blueprint $table) {
$table->increments('id_blok');
$table->unsignedInteger('id_perumahan');
$table->string('nama_blok', 50);
$table->foreign('id_perumahan')
->references('id_perumahan')
->on('perumahan')
->cascadeOnUpdate()
->cascadeOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('blok');
}
};

View File

@ -0,0 +1,81 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('properti', function (Blueprint $table) {
$table->increments('id_properti');
$table->unsignedInteger('id_perumahan');
$table->unsignedInteger('id_blok');
$table->string('nama_properti');
$table->enum('jenis_properti', [
'rumah',
'ruko'
]);
$table->enum('kategori_properti', [
'subsidi',
'komersial'
]);
$table->enum('tipe_properti', [
'30/60',
'36/72',
'45/84',
'60/135',
'Ruko'
]);
$table->decimal('harga_properti', 15, 2);
$table->bigInteger('bookingFee');
$table->decimal('luas_bangunan', 6, 2);
$table->decimal('luas_tanah', 6, 2);
$table->unsignedInteger('stok_unit');
$table->enum('status_unit', [
'tersedia',
'dipesan',
'terjual'
]);
$table->timestamps();
$table->foreign('id_perumahan')
->references('id_perumahan')
->on('perumahan')
->cascadeOnUpdate()
->cascadeOnDelete();
$table->foreign('id_blok')
->references('id_blok')
->on('blok')
->cascadeOnUpdate()
->cascadeOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('properti');
}
};

View File

@ -0,0 +1,87 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('transaksi', function (Blueprint $table) {
$table->increments('id_transaksi');
$table->unsignedInteger('id_properti');
$table->unsignedInteger('id_user');
$table->date('tanggal_transaksi');
$table->decimal('total_harga', 15, 2);
$table->enum('jenis_transaksi', [
'lunas',
'kredit',
'KPR'
]);
$table->enum('metode_pembayaran', [
'transfer_bank',
'virtual_account',
'qris_ewallet'
]);
$table->enum('bank_pengirim', [
'bca',
'mandiri',
'bni',
'bri',
'gopay',
'ovo',
'dana',
'bca_va',
'mandiri_va',
'bni_va'
])->nullable();
$table->date('tanggal_transfer')->nullable();
$table->enum('status_transaksi', [
'menunggu_pembayaran',
'menunggu_verifikasi',
'berhasil',
'ditolak',
'perlu_upload_ulang',
'pending'
]);
$table->string('bukti_transaksi')->nullable();
$table->timestamps();
$table->foreign('id_properti')
->references('id_properti')
->on('properti')
->cascadeOnUpdate()
->cascadeOnDelete();
$table->foreign('id_user')
->references('id_user')
->on('user')
->cascadeOnUpdate()
->cascadeOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('transaksi');
}
};

View File

@ -0,0 +1,79 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('pemesanan', function (Blueprint $table) {
$table->increments('id_pemesanan');
$table->unsignedInteger('id_user');
$table->unsignedInteger('id_properti');
$table->unsignedInteger('id_transaksi')->nullable();
$table->string('kode_pemesanan',20)->unique();
$table->enum('metode_pembayaran',[
'kredit',
'Lunas'
]);
$table->string('tahap_saat_ini');
$table->enum('status',[
'Proses',
'Selesai',
'Ditolak'
])->default('Proses');
$table->decimal('total_harga',15,2);
$table->dateTime('tanggal_pemesanan')->useCurrent();
$table->string('estimasi_proses')->nullable();
$table->text('catatan_admin')->nullable();
$table->timestamp('created_at')->useCurrent();
$table->timestamp('updated_at')
->useCurrent()
->useCurrentOnUpdate();
$table->foreign('id_user')
->references('id_user')
->on('user')
->cascadeOnUpdate()
->cascadeOnDelete();
$table->foreign('id_properti')
->references('id_properti')
->on('properti')
->cascadeOnUpdate()
->cascadeOnDelete();
$table->foreign('id_transaksi')
->references('id_transaksi')
->on('transaksi')
->cascadeOnUpdate()
->cascadeOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('pemesanan');
}
};

View File

@ -0,0 +1,100 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('dokumen', function (Blueprint $table) {
$table->increments('id_dokumen');
$table->unsignedInteger('id_user');
$table->unsignedInteger('id_pemesanan')->nullable();
$table->unsignedInteger('id_transaksi')->nullable();
$table->enum('jenis_dokumen',[
'ktp',
'kk',
'surat_nikah',
'npwp',
'slip_gaji',
'surat_keterangan_kerja',
'rekening_koran',
'spt_pajak',
'siup',
'surat_keterangan_usaha',
'pembukuan_usaha',
'selfie',
'foto_lokasi_usaha',
'foto_tempat_kerja',
'foto_3x4',
'surat_kerja',
'bukti_booking',
'dokumen_admin',
'surat_penghasilan_usaha',
'bukti_pembayaran'
]);
$table->string('nama_file');
$table->string('path_file');
$table->string('tipe_file',50);
$table->bigInteger('ukuran_file');
$table->enum('status_verifikasi',[
'pending',
'diterima',
'revisi',
'ditolak'
]);
$table->text('catatan_verifikasi')->nullable();
$table->timestamp('uploaded_at')->useCurrent();
$table->timestamp('verified_at')->nullable();
$table->enum('sumber_dokumen',[
'pelanggan',
'admin'
])->default('pelanggan');
$table->foreign('id_user')
->references('id_user')
->on('user')
->cascadeOnUpdate()
->cascadeOnDelete();
$table->foreign('id_pemesanan')
->references('id_pemesanan')
->on('pemesanan')
->cascadeOnDelete();
$table->foreign('id_transaksi')
->references('id_transaksi')
->on('transaksi')
->cascadeOnUpdate()
->cascadeOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('dokumen');
}
};

View File

@ -0,0 +1,71 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('notifikasi', function (Blueprint $table) {
$table->increments('id_notifikasi');
$table->unsignedInteger('id_user');
$table->string('judul')->nullable();
$table->text('pesan')->nullable();
$table->enum('tipe', [
'tagihan',
'pembayaran',
'dokumen',
'info',
'transaksi',
'verifikasi',
'monitoring',
'pelunasan'
])->nullable();
$table->boolean('status_baca')->default(false);
$table->enum('status_kirim', [
'pending',
'terkirim',
'gagal'
])->nullable();
$table->enum('channel', [
'in_app',
'email',
'whatsapp'
])->nullable();
$table->integer('referensi_id')->nullable();
$table->string('referensi_tipe',50)->nullable();
$table->timestamp('created_at')->useCurrent();
$table->foreign('id_user')
->references('id_user')
->on('user')
->cascadeOnUpdate()
->cascadeOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('notifikasi');
}
};

View File

@ -0,0 +1,46 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('chat_sessions', function (Blueprint $table) {
$table->increments('id_sessions');
$table->unsignedInteger('id_user')->nullable();
$table->enum('status_chat', [
'aktif',
'selesai',
'pending'
]);
$table->timestamp('started_at')->nullable();
$table->timestamp('ended_at')->useCurrent();
$table->foreign('id_user')
->references('id_user')
->on('user')
->cascadeOnUpdate()
->cascadeOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('chat_sessions');
}
};

View File

@ -0,0 +1,48 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('chat_messages', function (Blueprint $table) {
$table->increments('id_messages');
$table->unsignedInteger('id_sessions');
$table->enum('sender', [
'user',
'bot',
'admin'
]);
$table->text('message');
$table->json('properti_data')->nullable();
$table->dateTime('created_at')->useCurrent();
$table->foreign('id_sessions')
->references('id_sessions')
->on('chat_sessions')
->cascadeOnUpdate()
->cascadeOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('chat_messages');
}
};

View File

@ -6,16 +6,17 @@
return new class extends Migration return new class extends Migration
{ {
/**
* Run the migrations.
*/
public function up(): void public function up(): void
{ {
Schema::create('gambar_properti', function (Blueprint $table) { Schema::create('gambar_properti', function (Blueprint $table) {
$table->id('id_gambar'); $table->id('id_gambar');
$table->unsignedBigInteger('id_properti');
$table->unsignedInteger('id_properti');
$table->string('path_gambar'); $table->string('path_gambar');
$table->timestamps(); $table->timestamps();
$table->foreign('id_properti') $table->foreign('id_properti')
->references('id_properti') ->references('id_properti')
->on('properti') ->on('properti')
@ -23,11 +24,8 @@ public function up(): void
}); });
} }
/**
* Reverse the migrations.
*/
public function down(): void public function down(): void
{ {
Schema::dropIfExists('gambar_properti'); Schema::dropIfExists('gambar_properti');
} }
}; };

View File

@ -6,36 +6,31 @@
return new class extends Migration return new class extends Migration
{ {
/**
* Run the migrations.
*/
public function up(): void public function up(): void
{ {
Schema::create('log_aktivitas', function (Blueprint $table) { Schema::create('log_aktivitas', function (Blueprint $table) {
$table->id(); $table->id();
// HARUS SAMA: INT (bukan bigInteger) $table->unsignedInteger('id_user')->nullable();
$table->integer('id_user')->nullable();
$table->foreign('id_user')
->references('id_user')
->on('user')
->onDelete('set null');
$table->string('aktivitas'); $table->string('aktivitas');
$table->string('icon')->nullable(); $table->string('icon')->nullable();
$table->string('tipe')->nullable(); $table->string('tipe')->nullable();
$table->unsignedBigInteger('ref_id')->nullable(); $table->unsignedBigInteger('ref_id')->nullable();
$table->timestamps(); $table->timestamps();
$table->index('id_user'); $table->foreign('id_user')
->references('id_user')
->on('user')
->nullOnDelete();
}); });
} }
/**
* Reverse the migrations.
*/
public function down(): void public function down(): void
{ {
Schema::dropIfExists('log_aktivitas'); Schema::dropIfExists('log_aktivitas');

View File

@ -6,9 +6,6 @@
return new class extends Migration return new class extends Migration
{ {
/**
* Run the migrations.
*/
public function up(): void public function up(): void
{ {
Schema::create('visitor_logs', function (Blueprint $table) { Schema::create('visitor_logs', function (Blueprint $table) {
@ -20,15 +17,11 @@ public function up(): void
$table->string('page')->nullable(); $table->string('page')->nullable();
$table->timestamps(); $table->timestamps();
}); });
} }
/**
* Reverse the migrations.
*/
public function down(): void public function down(): void
{ {
Schema::dropIfExists('visitor_logs_'); Schema::dropIfExists('visitor_logs');
} }
}; };