diff --git a/app/Models/BankData.php b/app/Models/BankData.php new file mode 100644 index 0000000..437cdd1 --- /dev/null +++ b/app/Models/BankData.php @@ -0,0 +1,80 @@ + 'integer', + 'luas_tanah' => 'decimal:2', + 'luas_bangunan' => 'decimal:2', + 'tahun_bangunan' => 'integer', + 'harga' => 'decimal:2', + 'harga_diskon' => 'decimal:2', + 'diskon' => 'decimal:2', + 'total' => 'decimal:2', + 'kordinat_lat' => 'decimal:8', + 'kordinat_lng' => 'decimal:8', + 'harga_penawaran' => 'decimal:2', + 'tanggal' => 'date', + 'tgl_final_laporan' => 'date', + 'nilai_pasar' => 'decimal:2', + 'indikasi_nilai_likuidasi' => 'decimal:2', + 'indikasi_nilai_pasar_tanah' => 'decimal:2', + 'estimasi_harga_tanah' => 'decimal:2', + 'estimasi_harga_bangunan' => 'decimal:2', + 'indikasi_nilai_pasar_bangunan' => 'decimal:2', + 'indikasi_nilai_pasar_sarana_pelengkap' => 'decimal:2', + 'indikasi_nilai_pasar_mesin' => 'decimal:2', + 'indikasi_nilai_pasar_kendaraan_alat_berat' => 'decimal:2', + 'photos' => 'array' + ]; + + // Scope for filtering by asset type + public function scopeOfAssetType($query, $assetType) + { + return $query->where('jenis_aset', $assetType); + } + + // Scope for filtering by village + public function scopeOfVillage($query, $villageCode) + { + return $query->where('village_code', $villageCode); + } + + // Scope for filtering by district + public function scopeOfDistrict($query, $districtCode) + { + return $query->where('district_code', $districtCode); + } + + // Scope for filtering by city + public function scopeOfCity($query, $cityCode) + { + return $query->where('city_code', $cityCode); + } + + // Scope for filtering by province + public function scopeOfProvince($query, $provinceCode) + { + return $query->where('province_code', $provinceCode); + } + + // Scope for filtering by date + public function scopeOfDate($query, $date) + { + return $query->whereDate('tanggal', $date); + } + + // Scope for filtering by date range + public function scopeBetweenDates($query, $startDate, $endDate) + { + return $query->whereBetween('tanggal', [$startDate, $endDate]); + } + + } diff --git a/database/migrations/2025_03_17_130936_create_bank_data_table.php b/database/migrations/2025_03_17_130936_create_bank_data_table.php new file mode 100644 index 0000000..c3ad010 --- /dev/null +++ b/database/migrations/2025_03_17_130936_create_bank_data_table.php @@ -0,0 +1,69 @@ +id(); + $table->text('address')->nullable(); + $table->string('village_code')->nullable(); + $table->string('district_code')->nullable(); + $table->string('city_code')->nullable(); + $table->string('province_code')->nullable(); + $table->integer('tahun')->nullable(); + $table->decimal('luas_tanah', 15, 2)->nullable(); + $table->decimal('luas_bangunan', 15, 2)->nullable(); + $table->integer('tahun_bangunan')->nullable(); + $table->string('status_nara_sumber')->nullable(); + $table->decimal('harga', 15, 2)->nullable(); + $table->decimal('harga_diskon', 15, 2)->nullable(); + $table->decimal('diskon', 5, 2)->nullable(); + $table->decimal('total', 15, 2)->nullable(); + $table->string('nama_nara_sumber')->nullable(); + $table->string('peruntukan')->nullable(); + $table->string('penawaran')->nullable(); + $table->string('telepon')->nullable(); + $table->string('hak_properti')->nullable(); + $table->decimal('kordinat_lat', 10, 8)->nullable(); + $table->decimal('kordinat_lng', 11, 8)->nullable(); + $table->string('jenis_aset')->nullable(); + $table->string('foto_objek')->nullable(); + $table->date('tanggal')->nullable(); + $table->decimal('harga_penawaran', 15, 2)->nullable(); + $table->string('nomor_laporan')->nullable(); + $table->date('tgl_final_laporan')->nullable(); + $table->decimal('nilai_pasar', 15, 2)->nullable(); + $table->decimal('indikasi_nilai_likuidasi', 15, 2)->nullable(); + $table->decimal('indikasi_nilai_pasar_tanah', 15, 2)->nullable(); + $table->decimal('estimasi_harga_tanah', 15, 2)->nullable(); + $table->decimal('estimasi_harga_bangunan', 15, 2)->nullable(); + $table->decimal('indikasi_nilai_pasar_bangunan', 15, 2)->nullable(); + $table->decimal('indikasi_nilai_pasar_sarana_pelengkap', 15, 2)->nullable(); + $table->decimal('indikasi_nilai_pasar_mesin', 15, 2)->nullable(); + $table->decimal('indikasi_nilai_pasar_kendaraan_alat_berat', 15, 2)->nullable(); + $table->json('photos')->nullable(); + $table->timestamps(); + $table->softDeletes(); + + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('bank_data'); + } +};