Change to method used for retrieving settings data from Settings::instance() to Settings::get()

Seems simpler and more reliable.
This commit is contained in:
JayWll 2020-05-16 15:34:59 -06:00
parent 1c9de8f4b5
commit e4d86628aa
1 changed files with 2 additions and 6 deletions

View File

@ -1,15 +1,13 @@
<?php namespace JasonWilliams\CalgaryConditions\Components;
use Cms\Classes\ComponentBase;
use ApplicationException;
use October\Rain\Network\Http;
use JasonWilliams\CalgaryConditions\Models\Settings;
use Cache;
use ApplicationException;
class CurrentInfo extends ComponentBase
{
//public $fields;
public function componentDetails()
{
return [
@ -28,10 +26,8 @@ class CurrentInfo extends ComponentBase
public function onUpdateRequested()
{
$settings = Settings::instance();
$response = Cache::remember('weatherdata', 60, function() {
return json_decode(Http::get('http://api.weatherstack.com/current?access_key='.$settings->weatherstack_api_key.'&query=Calgary'));
return json_decode(Http::get('http://api.weatherstack.com/current?access_key='.Settings::get('weatherstack_api_key').'&query=Calgary'));
});
date_default_timezone_set('America/Edmonton');