On my search having $categroy_id - $country_id - $city_id. there is a table activities with all that value.
I just implement a function in my controller but its return all data.
My controller function code:
public function PlanActivity(Request $request){
$category_id = $request->category_id;
$countryid = $request->country_id;
$cityid = $request->city_id;
$listactivity = Activity::all(); // get all activity
if($category_id != '') {
$listactivity->where('category_id', function ($query) use ($category_id) {
$query->where('category_id', $category_id);
});
}
return view('front.plan_activity',compact('listactivity'));
}
How can i do this?