Level 3
you have to make two Eloquent model one is Employee and second is Reports
in employee model define the relationship with report
if employee has many reports than relationship will be
public function punchreports()
{
return $this->hasMany('App\Reports');
}
and query will be
Employee::with([
'punchreports' => function($query) {
$query->where('date',"2018-12-03)
}
])->where('status',"Active")->get();
1 like