31 lines
615 B
PHP
31 lines
615 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Loan extends Model
|
|
{
|
|
protected $fillable = [
|
|
'user_id', 'book_id', 'loan_code',
|
|
'borrowed_at', 'due_at', 'returned_at', 'status',
|
|
'fine_overdue', 'fine_damage', 'condition', 'return_notes'
|
|
];
|
|
|
|
protected $casts = [
|
|
'borrowed_at' => 'datetime',
|
|
'due_at' => 'datetime',
|
|
'returned_at' => 'datetime',
|
|
];
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function book()
|
|
{
|
|
return $this->belongsTo(Book::class);
|
|
}
|
|
}
|