44 lines
842 B
PHP
44 lines
842 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class BooksPublished extends Model
|
|
{
|
|
use HasFactory;
|
|
protected $table = 'books_published';
|
|
|
|
protected $fillable = [
|
|
'department_id',
|
|
'faculty_id',
|
|
'author',
|
|
'title',
|
|
'publisher',
|
|
'issn',
|
|
'date_of_publication',
|
|
'proof',
|
|
];
|
|
|
|
protected $casts = [
|
|
'date_of_publication' => 'date',
|
|
];
|
|
|
|
/**
|
|
* Get the department that owns the publication.
|
|
*/
|
|
public function department()
|
|
{
|
|
return $this->belongsTo(Department::class);
|
|
}
|
|
|
|
/**
|
|
* Get the faculty user that owns the publication.
|
|
*/
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class, 'faculty_id');
|
|
}
|
|
|
|
} |