Exemplo n.º 1
2
 public function detectDevice()
 {
     // @ https://github.com/jenssegers/agent
     $agent = new Agent();
     if ($agent->isMobile() || $agent->isTablet()) {
         if ($agent->is('android')) {
             return 'android';
         }
         if ($agent->is('iOS')) {
             return 'ios';
         }
         return $agent->platform();
     }
     if ($agent->isDesktop()) {
         if ($agent->is('Windows')) {
             return 'windows';
         }
         if ($agent->is('OS X')) {
             return 'OSX';
         }
         return 'desktop';
     }
 }
Exemplo n.º 2
0
 /**
  * @return bool
  */
 public function isMobile()
 {
     $cache = CM_Cache_Local::getInstance();
     return $cache->get($cache->key(__METHOD__, $this->_headerList), function () {
         return $this->_parser->isMobile();
     });
 }
Exemplo n.º 3
0
 /**
  * @medium
  * @dataProvider userAgentData
  */
 public function testUserAgents($userAgent, $isMobile, $isTablet, $version, $model, $vendor)
 {
     //make sure we're passed valid data
     if (!is_string($userAgent) || !is_bool($isMobile) || !is_bool($isTablet)) {
         $this->markTestIncomplete("The User-Agent {$userAgent} does not have sufficient information for testing.");
         return;
     }
     //setup
     $md = new Agent();
     $md->setUserAgent($userAgent);
     //is mobile?
     $this->assertEquals($md->isMobile(), $isMobile);
     //is tablet?
     $this->assertEquals($md->isTablet(), $isTablet);
     if (isset($version)) {
         foreach ($version as $condition => $assertion) {
             $this->assertEquals($assertion, $md->version($condition), 'FAILED UA (version("' . $condition . '")): ' . $userAgent);
         }
     }
     //version property tests
     if (isset($version)) {
         foreach ($version as $property => $stringVersion) {
             $v = $md->version($property);
             $this->assertSame($stringVersion, $v);
         }
     }
     //@todo: model test, not sure how exactly yet
     //@todo: vendor test. The below is theoretical, but fails 50% of the tests...
     /*if (isset($vendor)) {
           $method = "is$vendor";
           $this->assertTrue($md->{$method}(), "Expected Mobile_Detect::{$method}() to be true.");
       }*/
 }
 public function submit()
 {
     if (Input::get('rating') == 'one') {
         $rating = 1;
     }
     if (Input::get('rating') == 'two') {
         $rating = 2;
     }
     if (Input::get('rating') == 'three') {
         $rating = 3;
     }
     if (Input::get('rating') == 'four') {
         $rating = 4;
     }
     if (Input::get('rating') == 'five') {
         $rating = 5;
     }
     DB::table('restaurants_reviews')->insert(['restaurants_id' => Input::get('rid'), 'user_id' => 0, 'text' => 'qwe', 'review_text' => Input::get('text'), 'rating' => $rating, 'source' => 'RL', 'source_link' => 'RL', 'updated_at' => '', 'user_name' => 'Guest', 'user_location' => Session::get('geoip-location.city') . ', ' . Session::get('geoip-location.state'), 'spin_status' => 1]);
     echo '<script>alert("Thank You for your valuable review");</script>';
     $data['restaurant'] = \App\Restaurants::where('permalink', '=', Input::get('rlink'))->take(1)->get();
     $agent = new Agent();
     if ($agent->isMobile()) {
         return \View::make('mobile_restaurant')->with('data', $data);
     } else {
         return \View::make('restaurant')->with('data', $data);
     }
 }
 /**
  * Show the application welcome screen to the user.
  *
  * @return Response
  */
 public function index()
 {
     DB::connection()->enableQueryLog();
     $data['location'] = GeoIP::getLocation();
     $l_city = $data['location']['city'];
     $l_state = $data['location']['state'];
     $agent = new Agent();
     $get_city = \App\City::where('city', '=', $l_city)->take(1)->get();
     if (count($get_city) != 0) {
         foreach ($get_city as $c) {
             $city = $c->id;
         }
     } else {
         $city = 894;
         $data['location']['city'] = 'Phoenix';
         $data['location']['state'] = 'AZ';
     }
     $data['recent_restaurants'] = \App\Restaurants::where('having_menu', '=', '1')->where('city_id', '=', $city)->orderBy(DB::raw('RAND()'))->take(4)->get();
     $data['recent_reviews'] = \App\Restaurant_Reviews::orderBy(DB::raw('RAND()'))->leftJoin('restaurants', 'restaurants_reviews.restaurants_id', '=', 'restaurants.id')->leftJoin('city', 'restaurants.city_id', '=', 'city.id')->leftJoin('state', 'restaurants.state_id', '=', 'state.id')->take(6)->get();
     //$data['nearest_zip'] = \App\Zip::where('zip', '>', (int)session('geoip-locations.postal_code')-10)->where('zip', '<', (int)session('geoip-locations.postal_code')+10)
     //  ->take(5)->get();
     //dd(DB::getQueryLog());
     //dd($data['recent_reviews']);
     if ($agent->isMobile()) {
         return view('mobile_home')->with($data);
     } else {
         return view('home')->with($data);
     }
 }
 public function testBasicMethods()
 {
     $this->assertNotEmpty($this->detect->getScriptVersion());
     $this->detect->setHttpHeaders(array('SERVER_SOFTWARE' => 'Apache/2.2.15 (Linux) Whatever/4.0 PHP/5.2.13', 'REQUEST_METHOD' => 'POST', 'HTTP_HOST' => 'home.ghita.org', 'HTTP_X_REAL_IP' => '1.2.3.4', 'HTTP_X_FORWARDED_FOR' => '1.2.3.5', 'HTTP_CONNECTION' => 'close', 'HTTP_USER_AGENT' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 6_0_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A523 Safari/8536.25', 'HTTP_ACCEPT' => 'text/vnd.wap.wml, application/json, text/javascript, */*; q=0.01', 'HTTP_ACCEPT_LANGUAGE' => 'en-us,en;q=0.5', 'HTTP_ACCEPT_ENCODING' => 'gzip, deflate', 'HTTP_X_REQUESTED_WITH' => 'XMLHttpRequest', 'HTTP_REFERER' => 'http://mobiledetect.net', 'HTTP_PRAGMA' => 'no-cache', 'HTTP_CACHE_CONTROL' => 'no-cache', 'REMOTE_ADDR' => '11.22.33.44', 'REQUEST_TIME' => '01-10-2012 07:57'));
     //12 because only 12 start with HTTP_
     $this->assertCount(12, $this->detect->getHttpHeaders());
     $this->assertTrue($this->detect->checkHttpHeadersForMobile());
     $this->detect->setUserAgent('Mozilla/5.0 (iPhone; CPU iPhone OS 6_0_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A523 Safari/8536.25');
     $this->assertNotEmpty($this->detect->getUserAgent());
     $this->assertTrue($this->detect->isMobile());
     $this->assertFalse($this->detect->isTablet());
     $this->assertTrue($this->detect->isIphone());
     $this->assertTrue($this->detect->isiphone());
     $this->assertTrue($this->detect->isiOS());
     $this->assertTrue($this->detect->isios());
     $this->assertTrue($this->detect->is('iphone'));
     $this->assertTrue($this->detect->is('ios'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $agent = new Agent();
     $set = Set::with('media', 'squares.purchase.media', 'content', 'rewards')->where('id', 1)->first();
     if ($agent->isMobile() || $agent->isTablet()) {
         return view('public.mobile.index', ['set' => $set]);
     }
     return view('public.index', ['set' => $set]);
 }
Exemplo n.º 8
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.º 9
0
 public function index()
 {
     $agent = new Agent();
     if ($agent->isMobile()) {
         return View::render($this->createView('DemoApp:frontend/index_mobile.html.twig'), array());
     } else {
         return View::render($this->createView('DemoApp:frontend/index.html.twig'), array());
     }
 }
Exemplo n.º 10
0
 public function getPlatform()
 {
     if ($this->agent->isPhone()) {
         return 'phone';
     }
     if ($this->agent->isTablet()) {
         return 'tablet';
     }
     if ($this->agent->isMobile()) {
         return 'mobile';
     }
     if ($this->agent->isDesktop()) {
         return 'desktop';
     }
     if ($this->agent->isRobot()) {
         return 'robot';
     }
     return null;
 }
Exemplo n.º 11
0
 public function access_channel()
 {
     $agent = new Agent();
     if ($agent->isMobile()) {
         return "Mobile";
     } elseif ($agent->isTablet()) {
         return "Tablet";
     } else {
         return "Web";
     }
 }
Exemplo n.º 12
0
 public function edit()
 {
     $agent = new Agent();
     if ($agent->isMobile() or $agent->isTablet()) {
         $messages = 'This feature is disabled for Mobile and Tablet devices. If you want to change profile information, do it later from allowed devices.';
         return redirect('/system/notification')->with('messages', $messages);
     } else {
         $name = \Auth::user()->name;
         $results = \DB::select('select * from users_data where name = ?', [$name]);
         return view('profile.edit')->with('results', $results);
     }
 }
Exemplo n.º 13
0
 public function testDevices()
 {
     $agent = new Agent();
     foreach ($this->devices as $device => $ua) {
         $agent->setUserAgent($ua);
         $this->assertTrue($agent->isMobile());
         $this->assertEquals($device, $agent->device());
         if (!strpos($device, ' ')) {
             $method = "is{$device}";
             $this->assertTrue($agent->{$method}());
         }
     }
 }
 public function create()
 {
     $agent = new Agent();
     if ($agent->isMobile() or $agent->isTablet()) {
         $messages = 'This feature is disabled for Mobile and Tablet devices. If you want to make a publication do it later from allowed devices.';
         return redirect('/system/notification')->with('messages', $messages);
     } else {
         if (\Auth::user()->suspend == true) {
             $messages = 'You are now suspended. Suspended users cannot publish contents.';
             return redirect('/system/notification')->with('messages', $messages);
         } else {
             return view('publication.create');
         }
     }
 }
Exemplo n.º 15
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $agent = new Agent();
     // Определяем устройство и устанавливаем пути к js контроллерам и видам
     if ($agent->isMobile()) {
         \Config::set('js-controllers.path_controllers', 'dist/main/ng');
         \Config::set('js-controllers.path_js_files', 'dist/main/js');
         \View::addLocation(realpath(base_path('resources/views/mobile')));
     } else {
         \Config::set('js-controllers.path_controllers', 'dist/main/ng');
         \Config::set('js-controllers.path_js_files', 'dist/main/js');
         \View::addLocation(realpath(base_path('resources/views/desktop')));
     }
     return $next($request);
 }
Exemplo n.º 16
0
 public function index()
 {
     $agent = new Agent();
     if (Auth::check()) {
         if (Auth::user()->email === NULL) {
             return view('base.referral');
         }
         if ($agent->isMobile() or $agent->isTablet()) {
             return view('base.nomobile');
         }
         $users = User::orderBy('id', 'desc')->take(50)->get();
         return view('base.home', compact('users'));
     }
     return view('welcome');
 }
Exemplo n.º 17
0
 /**
  * Display the home page.
  *
  * @return Response
  */
 public function index(Guard $auth)
 {
     //
     $agent = new Agent();
     $desk = $device = $agent->isMobile();
     if ($desk == 1) {
         $desk = "mobile";
     } else {
         $desk = "desk";
     }
     Session::put('device', $desk);
     if ($auth->check()) {
         $user = $auth->user();
         // $view = view('RegistroOperadores.registroStep1'); // revisar debe redirecccionar a otro lado
         return redirect('/myProfileOp')->with('user', $user->id);
     } else {
         $view = view('auth.completeRegister');
     }
     return $view;
 }
Exemplo n.º 18
0
 public function downloadfileAction($fileid)
 {
     $agent = new Agent();
     if ($agent->isMobile() || $agent->isTablet()) {
         $params = app('\\Aimeos\\Shop\\Base\\Page')->getSections('no-mobile-page');
         return \View::make('shop::page.nomobile', $params);
     }
     $user = Auth::user();
     $context = \App::make('\\Aimeos\\Shop\\Base\\Context')->get();
     $dlManager = \MShop_Factory::createManager($context, 'download');
     $search = $dlManager->createSearch(true);
     $expr = array($search->compare('==', 'download.fileid', $fileid), $search->compare('==', 'download.userid', $user->id), $search->getConditions());
     $search->setConditions($search->combine('&&', $expr));
     $dlList = $dlManager->searchItems($search);
     $download = reset($dlList);
     $relPath = $download->getUrl();
     $disk = Storage::disk(config('shop.distros.drivename'));
     $filename = substr(strrchr($relPath, "/"), 1);
     $filesize = $disk->size($relPath);
     $expDate = Carbon::parse($download->getTimeCreated())->addDays(config('shop.distros.max-time'));
     $expiration = $expDate->toFormattedDateString();
     $today = Carbon::now();
     $downloadtotal = config('shop.distros.max-downloads');
     $downloadcount = $download->getDownloads();
     $params = app('\\Aimeos\\Shop\\Base\\Page')->getSections('download-page');
     $params['fileid'] = $fileid;
     $params['filename'] = $filename;
     $params['filesize'] = $filesize;
     $params['downloadtotal'] = $downloadtotal;
     $params['downloadcount'] = $downloadcount;
     if ($today->gt($expDate) || $downloadcount >= $downloadtotal) {
         $params['expiration'] = 'Expired';
     } else {
         $params['expiration'] = $expiration;
     }
     return \View::make('shop::page.download', $params);
 }
Exemplo n.º 19
0
 /**
  * Register any application authentication / authorization services.
  *
  * @param  \Illuminate\Contracts\Auth\Access\Gate  $gate
  * @return void
  */
 public function boot(GateContract $gate)
 {
     $this->registerPolicies($gate);
     $gate->define('crud-users', function () {
         return \Auth::user()->isAdmin();
     });
     $gate->define('auth', function () {
         return \Auth::check();
     });
     $gate->define('home', function () {
         return Request::path() === '/' || Request::path() == 'home' || Request::path() == '' ? true : false;
     });
     $gate->define('admin/users', function () {
         return strpos(Request::path(), 'admin/users') === false ? true : false;
     });
     $gate->define('ismobile', function () {
         $agent = new Agent();
         return $agent->isMobile();
     });
     $gate->define('isphone', function () {
         $agent = new Agent();
         return $agent->isPhone();
     });
 }
Exemplo n.º 20
0
<?php

use Jenssegers\Agent\Agent;
$Agent = new Agent();
// agent detection influences the view storage path
if ($Agent->isMobile()) {
    $viewPath = 'resources/views/mobile';
} else {
    $viewPath = 'resources/views/desktop';
}
return ['paths' => [realpath(base_path($viewPath))], 'compiled' => realpath(storage_path('framework/views'))];
Exemplo n.º 21
0
 private function getBodyClass()
 {
     $agent = new Agent();
     $browser_css_classes = array();
     $unsupported = [];
     if ($mobile = $agent->isMobile()) {
         $browser_css_classes[] = 'device-mobile';
     }
     if ($tablet = $agent->isTablet()) {
         $browser_css_classes[] = 'device-tablet';
     }
     if ($iphone = $agent->is('iPhone')) {
         $browser_css_classes[] = 'device-iphone';
     }
     if ($ipad = $agent->is('iPad')) {
         $browser_css_classes[] = 'device-ipad';
     }
     $other_browser = $agent->browser();
     if ($agent->browser() == "Safari") {
         $other_browser = false;
         $browser_css_classes[] = 'browser-safari';
         if ($agent->version('Safari') < 5) {
             $unsupported['browser'] = 'Safari';
         }
     }
     if ($agent->browser() == "Chrome") {
         $other_browser = false;
         $browser_css_classes[] = 'browser-chrome';
         $browser_css_classes[] = 'browser-chrome-' . (int) $agent->version('Chrome');
         if ($agent->version('Chrome') < 30) {
             $unsupported['browser'] = 'Chrome';
         }
     }
     if ($agent->browser() == "Firefox") {
         $other_browser = false;
         $browser_css_classes[] = 'browser-firefox';
         $browser_css_classes[] = 'browser-firefox-' . (int) $agent->version('Firefox');
         if ($agent->version('Firefox') < 25) {
             $unsupported['browser'] = 'Firefox';
         }
     }
     if ($browser = $agent->browser() == "IE") {
         $version = $agent->version("IE");
         $version = str_replace('.0', '', $version);
         $other_browser = false;
         $browser_css_classes[] = 'browser-ie';
         $browser_css_classes[] = 'browser-ie-' . (int) $version;
         if ((int) $version < 10) {
             $browser_css_classes[] = 'browser-lt-ie10';
         }
         if ((int) $version < 9) {
             $unsupported['browser'] = 'Internet Explorer';
         }
         $browser_css_classes[] = 'browser-ie' . $version;
     }
     if ($other_browser) {
         $browser_css_classes[] = 'browser-' . strtolower($other_browser);
         $version = (int) $agent->version($other_browser);
         $browser_css_classes[] = 'browser-' . strtolower($other_browser) . '-' . $version;
     }
     if ($agent->is('Windows')) {
         $browser_css_classes[] = 'os-windows';
     }
     if ($agent->is('OS X')) {
         $browser_css_classes[] = 'os-mac';
     }
     if ($agent->isDesktop()) {
         $browser_css_classes[] = 'desktop';
     } else {
         //Don't display errors on non-desktop devices
         $unsupported = [];
     }
     $browser_css_classes = implode(' ', $browser_css_classes);
     return $browser_css_classes;
 }
Exemplo n.º 22
0
 public function getRegionsId($id_region, PublicServiceRepository $gestion)
 {
     $agent = new Agent();
     $desk = $device = $agent->isMobile();
     if ($desk == 1) {
         $desk = "mobile";
     } else {
         $desk = "desk";
     }
     Session::put('device', $desk);
     $provincias = $gestion->getRegionDetails($id_region);
     $imagenes = $gestion->getImageporRegion($id_region);
     return view('public_page.front.allRegions')->with('provincias', $provincias)->with('imagenes', $imagenes)->with('region', $id_region);
 }
Exemplo n.º 23
0
 /**
  * Check if the device is mobile.
  * 
  * Returns true if any type of mobile device detected, including special ones
  *
  * @param null $userAgent deprecated
  * @param null $httpHeaders deprecated
  * @return bool 
  * @static 
  */
 public static function isMobile($userAgent = null, $httpHeaders = null)
 {
     //Method inherited from \Mobile_Detect
     return \Jenssegers\Agent\Agent::isMobile($userAgent, $httpHeaders);
 }
Exemplo n.º 24
0
function isMobile() {
  $agent = new MobileDetectAgent(); 
  return ($agent->isMobile() || $agent->isTablet());
}
Exemplo n.º 25
0
Route::get('/logout', array('as' => 'logout', 'uses' => 'UsersController@logout'));
Route::get('changePasswordView', array('as' => 'changePasswordView', 'uses' => 'UsersController@changePasswordView'));
Route::post('changePassword', array('as' => 'changePassword', 'uses' => 'UsersController@changePassword'));
Route::get('customerData', array('as' => 'customerData', 'uses' => 'CustomerController@viewCustomerData'));
Route::get('exportData', array('as' => 'exportData', 'uses' => 'CustomerController@exportCustomerData'));
Route::post('deleteData', array('as' => 'deleteCustomerData', 'uses' => 'CustomerController@deleteCustomerData'));
Route::get('contact', array('as' => 'contact', 'uses' => 'CustomerController@requestData'));
Route::post('contact', array('as' => 'contact', 'uses' => 'CustomerController@handleRequestData'));
Route::get('/', function () {
    $Agent = new Agent();
    // return View::make('index');
    if ($Agent->isMobile() && !$Agent->isTablet()) {
        return View::make('indexMobile');
    } else {
        return View::make('index');
    }
});
Route::get('/th', function () {
    Session::put('lang', 'th');
    return Redirect::to('/');
});
Route::get('/en', function () {
    Session::put('lang', 'en');
    $Agent = new Agent();
    // return View::make('index');
    if ($Agent->isMobile() && !$Agent->isTablet()) {
        return Redirect::to('/#Contact');
    } else {
        return Redirect::to('/#ContactNav');
    }
});
Route::post('write-a-review', array('as' => 'write-a-review/submit', 'uses' => 'WriteReviewController@submit'));
Route::get('write-a-review', function () {
    $data['meta_title'] = 'Write a Review for the Restaurants | Restaurant Listings|';
    $data['meta_description'] = 'Write a review | Restaurants Review | Online food Order, Get Menu, Reviews, Contact, Location Maps, Directions';
    $data['meta_keywords'] = 'Write A Review, Restaurants Reviews, Online food Order, Get Menu, Reviews, Contact, Location Maps, Directions';
    $data['location'] = Session::get('geoip-location.city') . ', ' . Session::get('geoip-location.state');
    $agent = new Agent();
    if ($agent->isMobile()) {
        return View::make('mobile_write_review')->with($data);
    } else {
        return View::make('write_review')->with($data);
    }
});
Route::post('write-a-review/search', array('as' => 'write-a-review/search', 'uses' => 'WriteReviewController@search'));
Route::get('write-a-review/{permalink}', function ($permalink) {
    $data['restaurant'] = \App\Restaurants::where('permalink', '=', $permalink)->take(1)->get();
    $data['meta_title'] = 'Write a Review for the restaurant | Restaurant Listings|';
    $data['meta_description'] = 'Write a review | Restaurants Review | Online food Order, Get Menu, Reviews, Contact, Location Maps, Directions';
    $data['meta_keywords'] = 'Write A Review, Restaurants Reviews, Online food Order, Get Menu, Reviews, Contact, Location Maps, Directions';
    $agent = new Agent();
    if ($agent->isMobile()) {
        return View::make('mobile_write_review_landing')->with($data);
    } else {
        return View::make('write_review_landing')->with($data);
    }
});
Route::get('voice', function () {
    return View::make('voice');
});
Route::post('voice', 'SearchController@voice');
Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController']);
Exemplo n.º 27
0
function is_mobile()
{
    $agent = new Agent();
    return $agent->isMobile();
}
Exemplo n.º 28
0
    if (Auth::check()) {
        $agent = new Agent();
        if ($agent->isMobile() && Auth::user()->role_id == 3) {
            return view('createappointment');
        } else {
            return view('welcome');
        }
    } else {
        return view('auth/login');
    }
});
Route::get('/', function () {
    View::share(array('site' => Site::all()->first(), 'captcha' => (new Captcha())->html()));
    if (Auth::check()) {
        $agent = new Agent();
        if ($agent->isMobile() && Auth::user()->role_id == 3) {
            return view('createappointment');
        } else {
            return view('welcome');
        }
    } else {
        return view('auth/login');
    }
});
Route::get('settings/', function () {
    View::share(array('site' => Site::all()->first(), 'captcha' => (new Captcha())->html()));
    if (Auth::check()) {
        return view('settings');
    } else {
        return view('auth/login');
    }
Exemplo n.º 29
-1
 /**
  * Set the user agent field
  *
  * @param string $value
  * @return string
  */
 public function setUserAgentAttribute($value)
 {
     $agent = new Agent();
     $agent->setUserAgent($value);
     $this->browser = $agent->browser();
     $this->browser_version = $agent->version($this->browser);
     $this->platform = $agent->platform();
     $this->platform_version = $agent->version($this->platform);
     $this->device = $agent->device() && !$agent->isDesktop() ? $agent->device() : '';
     $this->device_type = $agent->isMobile() ? 'mobile' : ($agent->isTablet() ? 'tablet' : ($agent->isDesktop() ? 'desktop' : ''));
     $this->attributes['user_agent'] = $value;
 }
Exemplo n.º 30
-1
 public function setUserAgentAttribute($value)
 {
     $agent = new Agent();
     $agent->setUserAgent($value);
     if ($agent->isDesktop()) {
         $platform = 'Desktop';
     } elseif ($agent->isMobile()) {
         if ($agent->isTablet()) {
             $platform = 'Tablet';
         } else {
             $platform = 'Mobile';
         }
     }
     $this->attributes['remote_platform'] = $platform;
     $this->attributes['user_agent'] = $value;
 }