30 lines
985 B
PHP
30 lines
985 B
PHP
<?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::create('peminjamans', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('anggota_id')->constrained('anggotas')->onDelete('cascade');
|
|
$table->foreignId('buku_id')->constrained('bukus')->onDelete('cascade');
|
|
$table->date('tanggal_pinjam');
|
|
$table->date('tanggal_kembali_rencana');
|
|
$table->date('tanggal_kembali_aktual')->nullable();
|
|
$table->enum('status', ['dipinjam', 'dikembalikan', 'terlambat'])->default('dipinjam');
|
|
$table->integer('denda')->default(0);
|
|
$table->text('catatan')->nullable();
|
|
$table->timestamps();
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('peminjamans');
|
|
}
|
|
};
|