public static function districtsArr() { $arr = array(); foreach (District::all() as $d) { $arr[$d->id] = $d->district; } return $arr; }
public static function distsNregs() { $res = District::all(); $ret = []; foreach ($res as $rw) { $ret[$rw->id] = $rw->regionID; } return $ret; }
public static function facilitiesByDistrictsArr2() { $arr = array(); $districts = Location\District::districtsArr(); foreach (Facility::select('id', 'facility', 'districtID')->get() as $f) { $d_name = array_key_exists($f->districtID, $districts) ? $districts[$f->districtID] : ''; $v = json_encode(['facility_id' => $f->id, 'facility_name' => $f->facility, 'district' => $d_name], JSON_FORCE_OBJECT); $arr[$d_name][$v] = $f->facility; } ksort($arr); return $arr; }
public function show($time = "") { if (empty($time)) { $time = date("Y"); } $regions = Region::regionsArr(); $districts = District::districtsArr(); $facility_levels = FacilityLevel::facilityLevelsArr(); $count_positives = Sample::countPositives($time); $av_positivity = Sample::avPositivity($time); $count_positives_arr = Sample::countPositives2($time); $av_positivity_arr = Sample::avPositivity2($time); return view('db/show', compact("time", "regions", "districts", "facility_levels", "count_positives", "av_positivity", "count_positives_arr", "av_positivity_arr")); }
private static function districtMonthsInit() { $districts = Location\District::districtsArr(); $months = \MyHTML::initMonths(); $ret = []; foreach ($districts as $dID => $d) { $ret[$dID] = $months; } return $ret; }