Tambah tabel dan model Authorization

- Menambahkan migrasi untuk tabel "authorizations" guna menyimpan data otorisasi terkait permohonan.
- Membuat model Authorization dengan relasi ke tabel Permohonan dan Users.
- Menyediakan cast dan properti fillable untuk mempermudah manipulasi data.
This commit is contained in:
Daeng Deni Mardaeni
2025-01-01 22:00:23 +07:00
parent 002882fe2f
commit ee52f70633
2 changed files with 107 additions and 0 deletions

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
{
public function up()
{
Schema::create('authorizations', function (Blueprint $table) {
$table->id();
$table->foreignId('permohonan_id')->constrained('permohonan')->onDelete('cascade');
$table->string('jenis');
// SO fields
$table->boolean('approve_so')->default(false);
$table->string('status_so')->nullable();
$table->text('keterangan_so')->nullable();
$table->timestamp('approve_so_at')->nullable();
// EO fields
$table->boolean('approve_eo')->default(false);
$table->string('status_eo')->nullable();
$table->text('keterangan_eo')->nullable();
$table->timestamp('approve_eo_at')->nullable();
// DD fields
$table->boolean('approve_dd')->default(false);
$table->string('status_dd')->nullable();
$table->text('keterangan_dd')->nullable();
$table->timestamp('approve_dd_at')->nullable();
$table->string('status')->nullable();
$table->text('keterangan')->nullable();
$table->text('request')->nullable();
$table->text('alasan')->nullable();
$table->foreignId('user_id')->nullable()->constrained('users')->onDelete('set null');
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('authorizations');
}
};