The following is the part of my code. But when I run that code, I am getting error "Trying to get property of non-object".
$searchdate = Input::get('curdate');
$teacherid = Auth::user()->id;
$student = WysStudent::where('studcls',$id)->get();
$clss = WysClass::where('clsteacher_id',$teacherid)->get();
$attendence_tbl = WysAttendancename::where('cls_id',$id)->first();
$wys_attendence_table = $attendence_tbl->attendance_name;
$attendance = DB::table($wys_attendence_table)->where('adate','=',$searchdate)->get();
if($attendance && $student){
foreach ($attendance as $attendance) {
foreach ($student as $student) {
var_dump($student->id);
}
}
}
How will I solve this problem??
$attendance = DB::table($wys_attendence_table)->where('adate','=',$searchdate)->get();