select('title', 'slug')->where('public_status', 0)->where('isPost', 0)->where('isMenu', 1)->orderBy('sortorder', 'asc')->get(); $res = array(); $key = 0; foreach ($get as $i) { array_push($res, ['key' => $key, 'title' => $i->title, 'slug' => $i->slug]); $key++; } return $res; } function getIp () { if (!empty($_SERVER['HTTP_CLIENT_IP'])) $ip = $_SERVER['HTTP_CLIENT_IP']; elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; else $ip = $_SERVER['REMOTE_ADDR']; return $ip; } ?>