my changes
This commit is contained in:
parent
28301e4312
commit
8dc1f1b048
263 changed files with 36882 additions and 4453 deletions
|
@ -1,44 +1,38 @@
|
|||
<?php namespace App;
|
||||
<?php
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Transaction extends Model {
|
||||
class Transaction extends Model
|
||||
{
|
||||
|
||||
protected $fillable = [
|
||||
'student_id',
|
||||
'book_id',
|
||||
'borrowed_at',
|
||||
'returned_at',
|
||||
'fines',
|
||||
'status'
|
||||
];
|
||||
protected $fillable = [
|
||||
'student_id',
|
||||
'book_id',
|
||||
'borrowed_at',
|
||||
'returned_at',
|
||||
'fines',
|
||||
'status'
|
||||
];
|
||||
|
||||
public function student()
|
||||
{
|
||||
|
||||
return $this->belongsTo('App\Student');
|
||||
|
||||
}
|
||||
public function student()
|
||||
{
|
||||
return $this->belongsTo('App\Person', 'student_id');
|
||||
}
|
||||
|
||||
public function book()
|
||||
{
|
||||
|
||||
return $this->belongsTo('App\Book');
|
||||
|
||||
}
|
||||
public function book()
|
||||
{
|
||||
//model, foreign key in tsis model, primary key of relation
|
||||
return $this->belongsTo('App\Book', 'book_id', 'id');
|
||||
}
|
||||
|
||||
public function scopeNotReturnedYet($query)
|
||||
{
|
||||
|
||||
return $query->where('status', 0);
|
||||
|
||||
}
|
||||
|
||||
public function scopeReturned($query)
|
||||
{
|
||||
|
||||
return $query->where('status', 1);
|
||||
|
||||
}
|
||||
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