errors()->messages())[0]; } public static function getUserInfo() { $user_info = User::getCurrentUser(); return $user_info; } public static function getUserId() { $user_info = self::getUserInfo(); $user_id = $user_info->id; return $user_id; } public static function endDataPut($data) { if (empty($data)) { $data = (object) array(); } return $data; } public static function formatImgUrl($data, $params = array()) { if (!$params || empty($data)) { return $data; } foreach ($data as $item) { foreach ($params as $v) { $item->$v = env('IMAGE_URL') . $item->$v; } } return $data; } public static function getDevice() { $device = 1; //android $user_agent = $_SERVER['HTTP_USER_AGENT']; if (strpos($user_agent, 'iPhone') || strpos($user_agent, 'iphone')) { $device = 2; //ios } return $device; } }