put('ConnectionDevice', 'desktop'); if (isset($deviceScale)) { $screenWidth = saveJavaScriptCookie( 'screenWidth' ); $screenHeight = saveJavaScriptCookie( 'screenHeight' ); $connectionDevice = 'desktop'; if (empty($screenWidth) || empty($screenHeight)) { return $next($request); } $deviceScaleList = explode(';', $deviceScale); foreach ($deviceScaleList as $deviceScale) { [$device, $scale] = explode('>', $deviceScale); if ($screenWidth > $scale) { $connectionDevice = $device; } } session()->put('ConnectionDevice', $connectionDevice); } return $next($request); } }