Ejemplo n.º 1
0
 /**
  * Create a fresh session array with a unique ID.
  *
  * @return array
  */
 public function fresh()
 {
     // Fetch a guest session with the same IP address
     $old_guest_session = $this->table()->where_user_id(1)->where_last_ip(Request::ip())->first();
     // We will simply generate an empty session payload array, using an ID
     // that is either not currently assigned to any existing session or
     // that belongs to a guest with the same IP address.
     if (is_null($old_guest_session)) {
         $id = $this->id();
     } else {
         $id = $old_guest_session->id;
         Session::instance()->exists = true;
     }
     return array('id' => $id, 'data' => array(':new:' => array(), ':old:' => array()));
 }