tethys/app/Student.php
2020-06-10 21:04:18 +02:00

43 lines
529 B
PHP
Executable File

<?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');
}
}