I want to store the "area" in the $area
variable from $school_info array
. Using $area
I want more 3 rows stored into 3 different arrays like: $school_info1
, $school_info2
, $school_info3
.
public function schooldetailviewid($id)
{
$school_id = $id;
$school_info = DB::table('school_infos')->where('school_id', '=', $school_id)->get();
$area = $school_info->area;
// recomendation start
$school_info1 = DB::table('school_infos')->where('area', '=', $area)->get();
$school_info2 = DB::table('school_infos')->where('area', '=', $area)->get();
$school_info3 = DB::table('school_infos')->where('area', '=', $area)->get();
// recomendation end
return view('schooldetail', compact('school_info', 'school_info1', 'school_info2', 'school_info3'));
}
Problem: Storing of elements is not working and also the 3 more rows are not fetched! I am trying to make a simple recommendation system.
Error
Exception Property [area] does not exist on this collection instance.