robot() public method

Get the robot name.
public robot ( string $userAgent = null ) : string
$userAgent string
return string
Exemplo n.º 1
0
 public function getUA()
 {
     // Initialize UA
     $agent = new Agent();
     $browser = $agent->browser();
     // Assemble data
     $data = ['browser' => $browser, 'browser_version' => $agent->version($browser), 'languages' => array($agent->languages()), 'device' => $agent->device(), 'platform' => $agent->platform(), 'is_mobile' => $agent->isMobile(), 'is_tablet' => $agent->isTablet(), 'is_desktop' => $agent->isDesktop(), 'is_robot' => $agent->isRobot(), 'robot_name' => $agent->robot()];
     return $data;
 }
Exemplo n.º 2
0
 public function insertUserInformation($ipAddress, $userAgentString, $sapiName, GeocoderResult $geocoderResult = null)
 {
     $userAgent = new UserAgent();
     $userAgent->setUserAgent($userAgentString);
     $browser = $userAgent->browser();
     $platform = $userAgent->platform();
     $data = ['ip_address' => $ipAddress, 'sapi_name' => substr($sapiName, 0, 32), 'user_agent' => substr($userAgentString, 0, 255), 'user_agent_browser' => substr($browser, 0, 32), 'user_agent_device' => substr($userAgent->device(), 0, 32), 'user_agent_browser_version' => substr($userAgent->version($browser), 0, 32), 'user_agent_platform_version' => substr($userAgent->version($platform), 0, 32), 'user_agent_platform' => substr($platform, 0, 32), 'user_agent_robot' => substr($userAgent->robot(), 0, 32)];
     if ($geocoderResult) {
         $region = $geocoderResult->getAdminLevels()->first();
         $data['geo_city'] = substr($geocoderResult->getLocality(), 0, 32);
         $data['geo_region'] = $region ? substr($region->getCode(), 0, 32) : null;
         $data['geo_country'] = substr($geocoderResult->getCountry(), 0, 32);
         $data['geo_country_code'] = substr($geocoderResult->getCountryCode(), 0, 6);
         $data['geo_latitude'] = substr($geocoderResult->getLatitude(), 0, 32);
         $data['geo_longitude'] = substr($geocoderResult->getLongitude(), 0, 32);
     }
     $this->getAdapter()->insert('dewdrop_activity_log_user_information', $data);
     return $this->getAdapter()->lastInsertId();
 }
Exemplo n.º 3
0
 /**
  * Record the visitation.
  *
  * @param Request $request
  * @author Cali
  */
 public static function visited(Request $request)
 {
     $userAgent = new Agent();
     $location = Location::get();
     static::create(['referer' => url()->previous(), 'uri' => $request->path(), 'browser' => $userAgent->browser(), 'platform' => $userAgent->platform(), 'device' => $userAgent->device(), 'mobile' => !$userAgent->isDesktop(), 'ip' => $location->ip, 'country' => $location->isoCode, 'city' => $location->cityName, 'robot' => $userAgent->isRobot() ? $userAgent->robot() : null, 'user_id' => $request->user() ? $request->user()->id : null]);
 }