laravel6 eager load grundchikd code example
Example: laravel eager loading where clause
$query = ""
if ($request->has('country'){
$query = Post::with("country")->whereHas("country",function($q) use($request){
$q->where("name","=",$request->country);
})->get()
}else{
$query = Post::with("country")->get();
}