35 lines
591 B
PHP
35 lines
591 B
PHP
<?php
|
|||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
|
||
|
|
class Book extends Model
|
||
|
|
{
|
||
|
|
protected $fillable = [
|
||
|
|
'title',
|
||
|
|
'slug',
|
||
|
|
'author',
|
||
|
|
'cover_image',
|
||
|
|
'publication_date',
|
||
|
|
'description',
|
||
|
|
'category_id',
|
||
|
|
];
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get the category that owns the book.
|
||
|
|
*/
|
||
|
|
public function category()
|
||
|
|
{
|
||
|
|
return $this->belongsTo(Category::class);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get the summary associated with the book.
|
||
|
|
*/
|
||
|
|
public function summary()
|
||
|
|
{
|
||
|
|
return $this->hasOne(Summary::class);
|
||
|
|
}
|
||
|
|
}
|