29 lines
558 B
PHP
29 lines
558 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Book extends Model
|
|
{
|
|
protected $fillable = [
|
|
'judul', 'penulis', 'cover', 'kode_buku', 'stok',
|
|
'category_id', 'tahun', 'status', 'is_new', 'tipe_akses', 'file_pdf', 'is_arsip'
|
|
];
|
|
|
|
protected $casts = [
|
|
'tipe_akses' => 'array',
|
|
'is_new' => 'boolean',
|
|
];
|
|
|
|
public function category()
|
|
{
|
|
return $this->belongsTo(Category::class);
|
|
}
|
|
|
|
public function loans()
|
|
{
|
|
return $this->hasMany(Loan::class);
|
|
}
|
|
}
|