36 lines
660 B
PHP
36 lines
660 B
PHP
<?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);
|
|
}
|
|
}
|