$user_agent = request()->header('user-agent'); if (false !== stripos($user_agent, 'win')) { $user_os = 'Windows'; } elseif (false !== stripos($user_agent, 'mac')) { $user_os = 'MAC'; } elseif (false !== stripos($user_agent, 'linux')) { $user_os = 'Linux'; } elseif (false !== stripos($user_agent, 'unix')) { $user_os = 'Unix'; } elseif (false !== stripos($user_agent, 'bsd')) { $user_os = 'BSD'; } elseif (false !== stripos($user_agent, 'iPad') || false !== stripos($user_agent, 'iPhone')) { $user_os = 'IOS'; } elseif (false !== stripos($user_agent, 'android')) { $user_os = 'Android'; } else { $user_os = 'Other'; } return $user_os ;