Add models and migrations for Anggota, Buku, Kategori, and Peminjaman

This commit is contained in:
2026-03-17 19:16:26 +07:00
parent 1aff175819
commit e8e28349fc
8 changed files with 242 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
<?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('bukus', function (Blueprint $table) {
$table->id();
$table->foreignId('kategori_id')->constrained('kategoris')->onDelete('cascade');
$table->string('judul');
$table->string('pengarang');
$table->string('penerbit');
$table->year('tahun_terbit');
$table->string('isbn', 20)->unique();
$table->integer('stok')->default(0);
$table->integer('stok_tersedia')->default(0);
$table->text('sinopsis')->nullable();
$table->string('cover')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
public function down(): void
{
Schema::dropIfExists('bukus');
}
};