tethys/app/Transaction.php

45 lines
549 B
PHP
Raw Normal View History

2015-07-19 06:49:24 +00:00
<?php namespace App;
use Illuminate\Database\Eloquent\Model;
class Transaction extends Model {
protected $fillable = [
'student_id',
'book_id',
'borrowed_at',
'returned_at',
'fines',
'status'
];
public function student()
{
return $this->belongsTo('App\Student');
}
public function book()
{
return $this->belongsTo('App\Book');
}
public function scopeNotReturnedYet($query)
{
return $query->where('status', 0);
}
public function scopeReturned($query)
{
return $query->where('status', 1);
}
}