initial commit
This commit is contained in:
commit
28301e4312
219 changed files with 23035 additions and 0 deletions
44
app/Transaction.php
Executable file
44
app/Transaction.php
Executable file
|
@ -0,0 +1,44 @@
|
|||
<?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);
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue