49 lines
968 B
PHP
49 lines
968 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Buku extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'buku';
|
|
protected $primaryKey = 'id_buku';
|
|
public $incrementing = true;
|
|
protected $keyType = 'int';
|
|
|
|
protected $fillable = [
|
|
'bibid',
|
|
'judul',
|
|
'edisi',
|
|
'penerbit',
|
|
'tahun_terbit',
|
|
'deskripsi_fisik',
|
|
'pengarang',
|
|
'nomor_panggil',
|
|
'konten_digital',
|
|
'eksemplar',
|
|
'id_kategori',
|
|
'cover',
|
|
'lokasi_x',
|
|
'lokasi_y',
|
|
];
|
|
|
|
protected $casts = [
|
|
'lokasi_x' => 'float',
|
|
'lokasi_y' => 'float',
|
|
];
|
|
|
|
public function peminjaman()
|
|
{
|
|
return $this->hasMany(Peminjaman::class, 'id_buku');
|
|
}
|
|
|
|
public function kategori()
|
|
{
|
|
return $this->belongsTo(Kategori::class, 'id_kategori', 'id_kategori');
|
|
}
|
|
}
|