/home/techb158/ileadtechnology.com/SSM/app/Models/academic
Edit: /home/techb158/ileadtechnology.com/SSM/app/Models/academic/ClassTeacher.php (1846B)
'array', 'date_effective' => 'date'];
protected $primaryKey = 'id';
protected $table = 'class_teachers';
protected static $logName = 'class_teacher';
protected static $logFillable = true;
protected static $logOnlyDirty = true;
protected static $ignoreChangedAttributes = ['updated_at'];
public function batch()
{
return $this->belongsTo('App\Models\Academic\Batch');
}
public function employee()
{
return $this->belongsTo('App\Models\Employee\Employee');
}
public function scopeFilterById($q, $id)
{
if (! $id) {
return $q;
}
return $q->where('id', '=', $id);
}
public function scopeFilterBySession($q)
{
return $q->whereHas('batch', function ($q1) {
$q1->whereHas('course', function ($q2) {
$q2->where('academic_session_id', '=', config('config.default_academic_session.id'));
});
});
}
public function scopeFilterByBatchId($q, $batch_id)
{
if (! $batch_id) {
return $q;
}
return $q->where('batch_id', '=', $batch_id);
}
public function scopeFilterByEmployeeId($q, $employee_id)
{
if (! $employee_id) {
return $q;
}
return $q->where('employee_id', '=', $employee_id);
}
}