I'm getting grade_id from the database:
$grade_id = DB::table('grades')->where('teacher_id',$teacher_id)->select('grade_id')->get();
and then I want to use that grade_id array in the where eloquent clause so I run
$home_feed = Home::join('home_grade', 'home_grade.home_id', '=', 'homes.id')
->whereIn('grade_id', $grade_id)
->get();
but when I run this I'm getting an error: Object of class stdClass could not be converted to string
What could be the problem? Thanks guys.
$grade_id = DB::table('grades')->where('teacher_id',$teacher_id)->select('grade_id')->first();$grade_id = DB::table('grades')->where('teacher_id',$teacher_id)->select('grade_id')->get()->lists('grade_id')->all();orDB::table('grades')->where('teacher_id',$teacher_id)->pluck('grade_id')->all()then second query