public static function addUserDevice()
 {
     if (Cookie::has('d_i')) {
         self::create(['user_id' => Auth::user()->id, 'uid' => Cookie::get('d_i'), 'browser' => Agent::browser(), 'platform' => Agent::platform(), 'device' => Agent::device()]);
         return true;
     } else {
         return false;
     }
 }
Esempio n. 2
0
 public function __construct()
 {
     $this->middleware('admin.auth');
     $this->middleware('admin.role');
     JavaScript::put(['lang' => Config::get('app.locale'), 'agent_browser' => Agent::browser(), 'agent_browser_version' => Agent::version(Agent::browser()), 'plateform' => Agent::platform(), 'plateform_version' => Agent::version(Agent::platform()), 'agent_isMobile' => Agent::isMobile(), 'agent_isTablet' => Agent::isTabet()]);
     JavaScript::put(['lang' => Config::get('app.locale')]);
     //view()->share('lang', Config::get('app.locale'));
     //View::share('lang', "fr");
 }
Esempio n. 3
0
 /**
  * Handle an incoming request.
  *
  * @param  Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle(Request $request, Closure $next)
 {
     if (!$request->ajax()) {
         $visit = new Visit();
         $visit->page = parse_url($request->fullUrl(), PHP_URL_PATH);
         $visit->ip = $request->ip();
         $visit->host = $request->getHost();
         $visit->user_agent = Agent::browser() . ' ' . Agent::version(Agent::browser());
         $visit->save();
     }
     return $next($request);
 }
Esempio n. 4
0
 public function __construct()
 {
     $this->middleware('guest');
     JavaScript::put(['lang' => Config::get('app.locale'), 'agent_browser' => Agent::browser(), 'agent_browser_version' => Agent::version(Agent::browser()), 'plateform' => Agent::platform(), 'plateform_version' => Agent::version(Agent::platform()), 'agent_isMobile' => Agent::isMobile(), 'agent_isTablet' => Agent::isTabet()]);
     /*view()->share('lang', Config::get('app.locale'));
     
     		if(Config::get('app.locale') == 'fr'):
     			view()->share('langreverse', 'en');
     		else:
     			view()->share('langreverse', 'fr');
     		endif;*/
     /**
      * Fix Chrome bug cache.
      *
      * https://code.google.com/p/chromium/issues/detail?id=28035
      */
     header("Expires: Fri, 01 Jan 1990 00:00:00 GMT");
     header("Pragma: no-cache");
     header("Cache-Control: private, no-cache, must-revalidate, no-store");
     header("Vary: *");
 }
Esempio n. 5
0
/**
 * Use in FilterAfter Log Functionalities
 * @return string
 */
function logGetDeviceName()
{
    if (Agent::is('Android')) {
        $device = Agent::device();
        $version = Agent::version($device);
        return $device . ' ' . $version;
    } elseif (Agent::is('iPhone')) {
        $device = Agent::device();
        $version = Agent::version($device);
        return $device . ' ' . $version;
    } else {
        $browser = Agent::browser();
        $version = Agent::version($browser);
        return $browser . ' ' . $version;
    }
}
 public static function start()
 {
     $session = self::create(['user_id' => Auth::user()->id, "browser" => Agent::browser(), "browser_version" => Agent::version(Agent::browser()), "platform" => Agent::platform(), "platform_version" => Agent::version(Agent::platform()), "mobile" => Agent::isMobile(), "device" => Agent::device(), "robot" => Agent::isRobot(), "device_uid" => Cookie::get('d_i', NULL), 'ip' => $_SERVER['REMOTE_ADDR'], 'last_activity' => Carbon::now()]);
     \Illuminate\Support\Facades\Session::put('dbsession.id', $session->id);
     return $session;
 }
Esempio n. 7
0
function isTabletClient()
{
    return Agent::isTablet();
}