diff --git a/app/Models/Curanmor.php b/app/Models/Curanmor.php index 9eee109..ec87d38 100644 --- a/app/Models/Curanmor.php +++ b/app/Models/Curanmor.php @@ -3,6 +3,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Factories\HasFactory; @@ -21,6 +22,10 @@ public function punyaKecamatanCuranmor(): BelongsTo{ return $this->belongsTo(Kecamatan::class, 'kecamatan_id'); } + public function curanmor_DetailCuranmor(): HasMany{ + return $this->hasMany(Detail_Curanmor::class); + } + protected $with = ['punyaKecamatanCuranmor', 'punyaKlasterCuranmor']; } diff --git a/app/Models/Curas.php b/app/Models/Curas.php index f35147a..ca2ed93 100644 --- a/app/Models/Curas.php +++ b/app/Models/Curas.php @@ -3,6 +3,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Factories\HasFactory; @@ -17,10 +18,13 @@ public function punyaKlasterCuras(): BelongsTo{ return $this->belongsTo(Klaster::class, 'klaster_id'); } - public function punyaKecamatanCuras(): BelongsTo { return $this->belongsTo(Kecamatan::class, 'kecamatan_id'); } + + public function curas_DetailCuras(): HasMany{ + return $this->hasMany(Detail_Curas::class); + } protected $with = ['punyaKlasterCuras', 'punyaKecamatanCuras']; diff --git a/app/Models/Detail_Curanmor.php b/app/Models/Detail_Curanmor.php new file mode 100644 index 0000000..b1b3cb5 --- /dev/null +++ b/app/Models/Detail_Curanmor.php @@ -0,0 +1,25 @@ + */ + use HasFactory; + + protected $guarded =['id']; + + public function detailCuranmor_Curanmor(): BelongsTo{ + return $this->belongsTo(Curanmor::class, 'curanmor_id'); + } + + public function detailCuranmor_Kecamatan(): BelongsTo{ + return $this->belongsTo(Kecamatan::class, 'detailCuranmor_kecamatan_Id'); + } + + protected $with = ['detailCuranmor_Curanmor', 'detailCuranmor_Kecamatan']; +} diff --git a/app/Models/Detail_Curas.php b/app/Models/Detail_Curas.php new file mode 100644 index 0000000..6c89894 --- /dev/null +++ b/app/Models/Detail_Curas.php @@ -0,0 +1,27 @@ + */ + use HasFactory; + + protected $guarded =['id']; + + public function detailCuras_Curas(): BelongsTo{ + return $this->belongsTo(Curas::class, 'curas_id'); + } + + public function detailCuras_Kecamatan(): BelongsTo{ + return $this->belongsTo(Kecamatan::class, 'detailCuras_kecamatan_Id'); + } + + protected $with = ['detailCuras_Curas', 'detailCuras_Kecamatan']; + +} diff --git a/app/Models/Kecamatan.php b/app/Models/Kecamatan.php index a6fb6eb..7792c08 100644 --- a/app/Models/Kecamatan.php +++ b/app/Models/Kecamatan.php @@ -2,9 +2,10 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasOne; +use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Database\Eloquent\Factories\HasFactory; class Kecamatan extends Model { @@ -20,4 +21,12 @@ public function kecamatanCuras(): HasOne { public function kecamatanCuranmor(): HasOne { return $this->hasOne(Curanmor::class); } + + public function kecamatan_DetailCuras(): HasMany{ + return $this->hasMany(Detail_Curas::class); + } + + public function kecamatan_DetailCuranmor(): HasMany{ + return $this->hasMany(Detail_Curanmor::class); + } } diff --git a/database/factories/DetailCuranmorFactory.php b/database/factories/DetailCuranmorFactory.php new file mode 100644 index 0000000..ae9a33c --- /dev/null +++ b/database/factories/DetailCuranmorFactory.php @@ -0,0 +1,23 @@ + + */ +class DetailCuranmorFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/DetailCurasFactory.php b/database/factories/DetailCurasFactory.php new file mode 100644 index 0000000..be96af4 --- /dev/null +++ b/database/factories/DetailCurasFactory.php @@ -0,0 +1,23 @@ + + */ +class DetailCurasFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/migrations/0001_01_01_000002_create_jobs_table.php b/database/migrations/0001_01_01_000002_create_jobs_table.php deleted file mode 100644 index 425e705..0000000 --- a/database/migrations/0001_01_01_000002_create_jobs_table.php +++ /dev/null @@ -1,57 +0,0 @@ -id(); - $table->string('queue')->index(); - $table->longText('payload'); - $table->unsignedTinyInteger('attempts'); - $table->unsignedInteger('reserved_at')->nullable(); - $table->unsignedInteger('available_at'); - $table->unsignedInteger('created_at'); - }); - - Schema::create('job_batches', function (Blueprint $table) { - $table->string('id')->primary(); - $table->string('name'); - $table->integer('total_jobs'); - $table->integer('pending_jobs'); - $table->integer('failed_jobs'); - $table->longText('failed_job_ids'); - $table->mediumText('options')->nullable(); - $table->integer('cancelled_at')->nullable(); - $table->integer('created_at'); - $table->integer('finished_at')->nullable(); - }); - - Schema::create('failed_jobs', function (Blueprint $table) { - $table->id(); - $table->string('uuid')->unique(); - $table->text('connection'); - $table->text('queue'); - $table->longText('payload'); - $table->longText('exception'); - $table->timestamp('failed_at')->useCurrent(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('jobs'); - Schema::dropIfExists('job_batches'); - Schema::dropIfExists('failed_jobs'); - } -}; diff --git a/database/migrations/2025_04_20_084549_create_detail__curas_table.php b/database/migrations/2025_04_20_084549_create_detail__curas_table.php new file mode 100644 index 0000000..d6fec6f --- /dev/null +++ b/database/migrations/2025_04_20_084549_create_detail__curas_table.php @@ -0,0 +1,32 @@ +id(); + $table->foreignId('curas_id')->constrained( + table: 'curas', indexName: 'detailCuras_curas_id'); + $table->float('tambahan_curas'); + $table->foreignId('detailCuras_kecamatan_Id')->constrained( + table: 'kecamatans', indexName: 'detailCuras_kecamatan_id'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('detail__curas'); + } +}; diff --git a/database/migrations/2025_04_20_084600_create_detail__curanmors_table.php b/database/migrations/2025_04_20_084600_create_detail__curanmors_table.php new file mode 100644 index 0000000..a76e306 --- /dev/null +++ b/database/migrations/2025_04_20_084600_create_detail__curanmors_table.php @@ -0,0 +1,32 @@ +id(); + $table->foreignId('curanmor_id')->constrained( + table: 'curanmors', indexName: 'detailCuranmor_curanmor_id'); + $table->float('tambahan_curanmor'); + $table->foreignId('detailCuranmor_kecamatan_Id')->constrained( + table: 'kecamatans', indexName: 'detailCuranmor_kecamatan_id'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('detail__curanmors'); + } +}; diff --git a/database/seeders/CuranmorSeeder.php b/database/seeders/CuranmorSeeder.php index 5f53394..2ecb1df 100644 --- a/database/seeders/CuranmorSeeder.php +++ b/database/seeders/CuranmorSeeder.php @@ -6,7 +6,6 @@ use App\Models\Curanmor; use App\Models\Kecamatan; use Illuminate\Database\Seeder; -use Illuminate\Database\Console\Seeds\WithoutModelEvents; class CuranmorSeeder extends Seeder { diff --git a/database/seeders/CurasSeeder.php b/database/seeders/CurasSeeder.php index 823e41b..4696d2a 100644 --- a/database/seeders/CurasSeeder.php +++ b/database/seeders/CurasSeeder.php @@ -6,19 +6,15 @@ use App\Models\Klaster; use App\Models\Kecamatan; use Illuminate\Database\Seeder; -use Illuminate\Database\Console\Seeds\WithoutModelEvents; class CurasSeeder extends Seeder { - /** - * Run the database seeds. - */ public function run(): void { - $klasterIds = Klaster::pluck('id'); // Ambil semua ID klaster - $kecamatanIds = Kecamatan::pluck('id'); // Ambil semua ID kecamatan + $klasterIds = Klaster::pluck('id'); + $kecamatanIds = Kecamatan::pluck('id'); - // Data jumlah curas untuk setiap kecamatan (sesuaikan dengan kebutuhan) + $dataCuras = [ 1 => 0, 2 => 0, @@ -42,16 +38,16 @@ public function run(): void 20 => 1, 21 => 0, 22 => 0, - 23 => 1, - 24 => 0, + 23 => 3, + 24 => 2, ]; - // Looping untuk membuat data curas berdasarkan kecamatan + foreach ($kecamatanIds as $kecamatanId) { Curas::create([ 'kecamatan_id' => $kecamatanId, - 'jumlah_curas' => $dataCuras[$kecamatanId], // Gunakan nilai default jika tidak ada data - 'klaster_id' => $klasterIds->random(), // Pilih klaster secara acak + 'jumlah_curas' => $dataCuras[$kecamatanId], + 'klaster_id' => $klasterIds->random(), ]); } } diff --git a/database/seeders/DetailCuranmorSeeder.php b/database/seeders/DetailCuranmorSeeder.php new file mode 100644 index 0000000..6d46092 --- /dev/null +++ b/database/seeders/DetailCuranmorSeeder.php @@ -0,0 +1,19 @@ + +
+
+
+
+
+
+

Detail Kasus Curas Per Tanggal

+

Berikut ini merupakan rincian kasus Pencurian Dengan Kekerasan (CURAS)
+ yang dikelompokkan berdasarkan tanggal

+
+ Tambah Kasus Curas +
+ @if (session()->has('succes')) + + @endif + @if (session()->has('error')) + + @endif +
+
+
+ + + + + + + + + + + + {{-- @foreach ( $curases as $curas ) --}} + + + + + + + + + + + {{-- @endforeach --}} +
+
+ + +
+
NoTanggalTambahan Kasus CurasNama KecamatanHapus Kasus
+
+ + +
+
+
+
+ @method('delete') + @csrf + + +
+
+
+
+
+
+ +
+
+ \ No newline at end of file diff --git a/resources/views/Admin/dashboardListCuras.blade.php b/resources/views/Admin/dashboardListCuras.blade.php index a6e22c5..3af730e 100644 --- a/resources/views/Admin/dashboardListCuras.blade.php +++ b/resources/views/Admin/dashboardListCuras.blade.php @@ -37,7 +37,6 @@ Nama Kecamatan Jumlah Kasus Curas Klaster - Action @foreach ( $curases as $curas ) @@ -52,19 +51,7 @@ {{ $loop->iteration }} {{ $curas->punyaKecamatanCuras->nama_kecamatan}} {{ $curas->jumlah_curas }} - {{ $curas -> punyaKlasterCuras -> nama_klaster }} - -
- -
- @method('delete') - @csrf - - -
-
- + {{ $curas->punyaKlasterCuras->nama_klaster }} @endforeach diff --git a/resources/views/components/layoutAdmin.blade.php b/resources/views/components/layoutAdmin.blade.php index 91eaf66..69451b3 100644 --- a/resources/views/components/layoutAdmin.blade.php +++ b/resources/views/components/layoutAdmin.blade.php @@ -9,7 +9,7 @@ - + diff --git a/resources/views/landing.blade.php b/resources/views/landing.blade.php index 1d89a73..b46ca77 100644 --- a/resources/views/landing.blade.php +++ b/resources/views/landing.blade.php @@ -1453,6 +1453,7 @@ class="tab-pane show active"
+
diff --git a/routes/web.php b/routes/web.php index 9c7054a..1843a6d 100644 --- a/routes/web.php +++ b/routes/web.php @@ -14,6 +14,10 @@ return view('landing'); }); +Route::get('/detail', function () { + return view('admin.dashboardDetailCuras'); +}); + Route::get('/blank', function () { return view('admin.dashboardBlank');