/** * Verify CSRF tokens match. * * @param $token * @return bool */ public static function checkToken($token) { if (Session::get('csrf_token') !== $token) { return false; } return true; }
/** * Get weather data from the session cache. * * @param $remote * @return mixed */ protected static function getData($remote) { if (!Session::has('weather-data')) { $weatherData = $remote->getData('http://api.openweathermap.org/data/2.5/weather?zip=' . ZIP_CODE . ',us', null); $sessionData = ['weather-data' => $weatherData]; Session::put($sessionData); return $weatherData; } return Session::get('weather-data'); }
/** * Get the ID of the authenticated user. * * @return mixed */ public function getAuthenticatedUser() { return Session::get('id'); }