[], 'columns' => []]; } $hints = Cache::remember('value_hints_data', 3600, function() { $data = []; // Joint types: short_name_en/ru -> definition_en + definition_ru + title $jointTypes = db("joint_types")->whereNotNull("short_name_en")->get(); foreach($jointTypes as $jt) { $hint = []; if(!empty($jt->definition_en)) $hint[] = $jt->definition_en; if(!empty($jt->definition_ru)) $hint[] = $jt->definition_ru; if(!empty($jt->title)) $hint[] = $jt->title; if(!empty($hint) && !empty($jt->short_name_en)) { $data[$jt->short_name_en] = implode(' / ', array_unique($hint)); } if(!empty($jt->short_name_ru) && !empty($hint)) { $data[$jt->short_name_ru] = implode(' / ', array_unique($hint)); } } // Welding methods: iso_short_name/aws_short_name/ru_short_name -> definitions $weldingMethods = db("welding_methods")->get(); foreach($weldingMethods as $wm) { $hint = []; if(!empty($wm->iso_4063_definition)) $hint[] = $wm->iso_4063_definition; if(!empty($wm->russian_definition)) $hint[] = $wm->russian_definition; if(!empty($hint)) { if(!empty($wm->iso_short_name)) $data[$wm->iso_short_name] = implode(' / ', $hint); if(!empty($wm->aws_short_name)) $data[$wm->aws_short_name] = implode(' / ', $hint); if(!empty($wm->ru_short_name)) $data[$wm->ru_short_name] = implode(' / ', $hint); if(!empty($wm->en_welding_number)) $data[$wm->en_welding_number] = implode(' / ', $hint); } } return $data; }); return ['hints' => $hints, 'columns' => $hintColumns]; } function clear_value_hints_cache() { Cache::forget('value_hints_data'); }