tethys/app/Student.php

43 lines
529 B
PHP
Raw Normal View History

2015-07-19 06:49:24 +00:00
<?php namespace App;
use Illuminate\Database\Eloquent\Model;
class Student extends Model {
protected $fillable = [
'name',
'registered_at',
'borrow',
'status'
];
public function transactions()
{
return $this->hasMany('App\Transaction');
}
public function scopeNotLimit($query)
{
return $query->where('borrow', '<', 3);
}
public function scopeActive($query)
{
return $query->where('status', 1);
}
public function scopeOrderByName($query)
{
return $query->orderBy('name');
}
}