<?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('pelaporans', function (Blueprint $table) {
        //     $table->id();
        //     $table->string('judul');
        //     $table->string('keterangan');
        //     $table->date('tanggal');
        //     $table->string('lokasi');
        //     $table->string('status');
        //     $table->string('foto')->nullable();
        //     $table->timestamps();
        // });
        Schema::create('pelaporans', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('tindakan_id')->default(1)->nullable();
            $table->foreign('tindakan_id')->references('id')->on('tindakans');
            $table->unsignedBigInteger('user_id'); // Tambahkan kolom user_id
            $table->foreign('user_id')->references('id')->on('users'); // Referensi ke tabel users
            $table->string('judul');
            $table->string('keterangan');
            $table->string('tanggal');
            $table->string('lokasi');
            $table->string('status');
            $table->string('saran');
            $table->string('foto');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('pelaporan');
    }
};
