join('sub_district', 'sub_district.id', '=', 'village.sub_district_id') ->get(); return response()->json([ 'allVillage' => $allDataVillage ]); } public function excelParameterHeightVillage($year) { $parameterHeightVillage = HeightVillage::select('height_village.id as height_id', 'height_village.height', 'height_village.year', 'village.id as village_id', 'village.village', 'sub_district.sub_district') ->join('village', 'height_village.village_id', '=', 'village.id') ->join('sub_district', 'village.sub_district_id', '=', 'sub_district.id') ->where('height_village.year', $year) ->get(); return Excel::download(new ParameterHeightVillageExport($parameterHeightVillage), 'parameter-ketinggian-desa-tahun-' . $year . '.xlsx'); } }