Add models and migrations for Anggota, Buku, Kategori, and Peminjaman
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<?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');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user