Пример #1
0
 /**
  * Checks for user cookie and is not present creates one.
  *
  * @return (void)
  */
 public function __construct()
 {
     if (\Session::has('user_cookie')) {
         $this->user = User::where('cookie', \Session::get('user_cookie'))->first();
         if (!is_null($this->user)) {
             $this->loggedIn = true;
         }
     } else {
         \Session::put('user_cookie', md5(uniqid(rand(), true)));
     }
     return $this->user;
 }