generated from Flycro/laravel-nuxt
35 lines
618 B
PHP
35 lines
618 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class BookRecommendation extends Model
|
|
{
|
|
protected $table = 'book_recommendations';
|
|
|
|
protected $fillable = [
|
|
'book_name',
|
|
'author',
|
|
'description',
|
|
'isbn',
|
|
'pages',
|
|
'recommended_by',
|
|
'cover_image',
|
|
'status',
|
|
];
|
|
|
|
/**
|
|
* Get the user that recommended the book.
|
|
*/
|
|
public function recommender()
|
|
{
|
|
return $this->belongsTo(User::class, 'recommended_by');
|
|
}
|
|
|
|
public function votes()
|
|
{
|
|
return $this->hasMany(Vote::class);
|
|
}
|
|
}
|