bookclub-manager/app/Models/BookRecommendation.php

41 lines
735 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',
'published_at',
];
/**
* 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);
}
public function deadlines()
{
return $this->hasMany(Deadline::class);
}
}