/** * Get Csrfvalidator instance * * @return static */ function csrf() { $session = Session::make()->factory(); return CsrfValidator::make($session); }
/** * We will set session * * @return mixed */ private function setSession() { $primaryKey = null; $data = array(); $primaryKey = self::$user[0]->getPrimaryKey(); $data[$primaryKey] = self::$user[0]->{$primaryKey}; foreach (self::$user[0]->getAttributes() as $key => $val) { $data[$key] = $val; } $data['isLoggedIn'] = true; $data['flashMsg'] = static::$msg . ucfirst($this->username); Session::set('auth:' . trim($this->table), $data); return true; }
/** * Check is there any flash message in session * * @param string $key * @return bool * */ public function hasFlash($key = null) { $flashArray = Session::get('flashMessages'); if (!is_null($key)) { if (@isset($flashArray[$key])) { return @$flashArray[$key]; } } return false; }