public function login($username = null, $pass = null, $remember = false) { if (!$username && !$pass && $this->exist()) { Session::put($this->_sessionName, $this->data()->id); } else { $user = $this->find($username); if ($user) { if ($this->_data->password === Hash::make($pass, $this->_data->salt)) { Session::put($this->_sessionName, $this->_data->id); if ($remember) { $hash = hash::unique(); $hashCheck = $this->_db->get('user_session', array('user_id', '=', $this->data()->id)); if (!$hashCheck->count()) { $this->_db->insert('user_session', array('user_id' => $this->_data->id, 'hash' => $hash)); } else { $hash = $hashCheck->first()->hash; } Cookies::put($this->_cookieName, $hash, config::get('remember/expiry')); } return true; } } } return false; }