Add models and migrations for Anggota, Buku, Kategori, and Peminjaman
This commit is contained in:
35
app/Models/Buku.php
Normal file
35
app/Models/Buku.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Buku extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'kategori_id',
|
||||
'judul',
|
||||
'pengarang',
|
||||
'penerbit',
|
||||
'tahun_terbit',
|
||||
'isbn',
|
||||
'stok',
|
||||
'stok_tersedia',
|
||||
'sinopsis',
|
||||
'cover',
|
||||
];
|
||||
|
||||
public function kategori()
|
||||
{
|
||||
return $this->belongsTo(Kategori::class);
|
||||
}
|
||||
|
||||
public function peminjamans()
|
||||
{
|
||||
return $this->hasMany(Peminjaman::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user